用httpClient拉取服务端数据不定时出现下面的异常,请求大神解答

非非非常大的草履虫 2018-03-06 01:46:07
用httpClient发送http请求,拉取服务端的数据,不定时会出现下面的异常:
网络异常,堆栈轨迹如下
java.net.SocketException: Software caused connection abort: recv failed
at java.net.SocketInputStream.socketRead0(Native Method) ~[na:1.8.0_112]

at java.net.SocketInputStream.socketRead(SocketInputStream.java:116) ~[n
a:1.8.0_112]
at java.net.SocketInputStream.read(SocketInputStream.java:170) ~[na:1.8.
0_112]
at java.net.SocketInputStream.read(SocketInputStream.java:141) ~[na:1.8.
0_112]
at org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInpu
tBufferImpl.java:137) ~[httpcore-4.4.6.jar:4.4.6]
at org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInpu
tBufferImpl.java:153) ~[httpcore-4.4.6.jar:4.4.6]
at org.apache.http.impl.io.SessionInputBufferImpl.readLine(SessionInputB
ufferImpl.java:282) ~[httpcore-4.4.6.jar:4.4.6]
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(Default
HttpResponseParser.java:138) ~[httpclient-4.5.3.jar:4.5.3]
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(Default
HttpResponseParser.java:56) ~[httpclient-4.5.3.jar:4.5.3]
at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessagePa
rser.java:259) ~[httpcore-4.4.6.jar:4.4.6]
at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHead
er(DefaultBHttpClientConnection.java:163) ~[httpcore-4.4.6.jar:4.4.6]
at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy
.java:165) ~[httpclient-4.5.3.jar:4.5.3]
at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRe
questExecutor.java:273) ~[httpcore-4.4.6.jar:4.4.6]
at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecu
tor.java:125) ~[httpcore-4.4.6.jar:4.4.6]
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.
java:272) ~[httpclient-4.5.3.jar:4.5.3]
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java
:185) ~[httpclient-4.5.3.jar:4.5.3]
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89) ~
[httpclient-4.5.3.jar:4.5.3]
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java
:111) ~[httpclient-4.5.3.jar:4.5.3]
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttp
Client.java:185) ~[httpclient-4.5.3.jar:4.5.3]
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttp
Client.java:83) ~[httpclient-4.5.3.jar:4.5.3]
at cn.titantec.powerweb.util.HttpClientUtil.sendPostRequest(HttpClientUt
il.java:254) [HttpClientUtil.class:na]
at cn.titantec.powerweb.util.HttpClientUtil.sendPostRequest(HttpClientUt
il.java:217) [HttpClientUtil.class:na]

客户端采用httpClient拉取数据;
服务端是采用spring+spring-mvc架构。哪位大神能解答下?

---------------------------------------------------------------------------------------------------
httpClient版本号:
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.3</version>
</dependency>
...全文
900 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
引用 1 楼 tianfang的回复:
用浏览器的调试器跟踪一下post过程,最好可以贴代码 像返回数据长度处理的问题
谢谢大神的回答。昨天我增大了tomcat的最大连接数及请求最大等待时间,目前还没有发现问题重现
tianfang 2018-03-07
  • 打赏
  • 举报
回复
用浏览器的调试器跟踪一下post过程,最好可以贴代码 像返回数据长度处理的问题

50,566

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧