org.apache.http.NoHttpResponseException


org.apache.http.NoHttpResponseException

异常: org.apache.http.NoHttpResponseException: The target server failed to respond 
  at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:141) 
  at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56) 
  at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259) 
  at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163) 
  at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:165) 
  at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273) 
  at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125) 
  at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272) 
  at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185) 
  at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89) 
  at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111) 
  at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185) 
  at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83) 
  at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:108) 

主要原因server端连接已经关闭, client没有接收到关闭的通知

httpClient 4.4中setStaleConnectionCheckEnabled默认变成false了, 之前的版本默认是true 换jar版本要详细测试
  • 解决方法:
    • client请求加重试
    • client起线程主动检查


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM