• 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起线程主动检查
  • 相关阅读:
    密码 (pasuwado)
    bzoj 4131: 并行博弈 (parallel)
    Beads
    bzoj2338数矩形(rectangle)
    数树数
    最近公共祖先(lca)
    在python中遍历字典元素
    加载本地json文件,并利用批处理调用Chrome显示html
    numpy保存数据
    Echarts 地理信息可视化:基于地图显示坐标点信息
  • 原文地址:https://www.cnblogs.com/yszzu/p/11159945.html
Copyright © 2020-2023  润新知