处理对<hostname>的请求时捕获到I / O异常(org.apache.http.NoHttpResponseException):目标服务器无法响应

时间:2017-10-02 17:52:36

标签: java apache http tomcat

问题:我间歇性地收到此错误消息。我使用的是httpclient-4.5.2和PoolingClientConnectionManager

我尝试了什么:

  1. 由于某些帖子暗示这可能是由于陈旧 连接,我尝试使用

    从连接管理器清理它
    connectionManager.closeExpiredConnections();
    connectionManager.closeIdleConnections( idleTime, TimeUnit.MINUTES );
    

    建议使用here

  2. 我也试过HttpConnectionParams.setStaleCheckingEnabled( reqParams,true);

    ,如doc

  3. 我启用了wirelogs,但没有什么异常:

    2017-09-25T02:26:36.109495-07:00  tomcat: [PoolingClientConnectionManager] DEBUG: Connection request: [route: {s}->https://host:443][total kept alive: 3; route allocated: 4 of 20; total allocated: 7 of 800]
    2017-09-25T02:26:36.109598-07:00  tomcat: [PoolingClientConnectionManager] DEBUG: Connection leased: [id: 150][route: {s}->https://host:443][total kept alive: 2; route allocated: 4 of 20; total allocated: 7 of 800]
    2017-09-25T02:26:36.111038-07:00  tomcat: [DefaultClientConnection] DEBUG: Sending request: GET /api/v1/foo HTTP/1.1
    2017-09-25T02:26:36.111152-07:00  tomcat: [Wire] DEBUG:  >> "GET /api/v1/foo HTTP/1.1[\r][\n]"
    2017-09-25T02:26:36.111282-07:00  tomcat: [Wire] DEBUG:  >> "Accept: application/json[\r][\n]"
    2017-09-25T02:26:36.111373-07:00  tomcat: [Wire] DEBUG:  >> "Cookie: JSESSIONID=432jnfjwnfkjw3[\r][\n]"
    2017-09-25T02:26:36.111459-07:00  tomcat: [Wire] DEBUG:  >> "Accept-Encoding: gzip,deflate[\r][\n]"
    2017-09-25T02:26:36.111541-07:00  tomcat: [Wire] DEBUG:  >> "Content-Length: 0[\r][\n]"
    2017-09-25T02:26:36.111635-07:00  tomcat: [Wire] DEBUG:  >> "Host: host:443[\r][\n]"
    2017-09-25T02:26:36.111712-07:00  tomcat: [Wire] DEBUG:  >> "Connection: Keep-Alive[\r][\n]"
    2017-09-25T02:26:36.111789-07:00  tomcat: [Wire] DEBUG:  >> "[\r][\n]"
    2017-09-25T02:26:36.112470-07:00  tomcat: [DefaultClientConnection] DEBUG: Connection 0.0.0.0:57992<->10.2.1.1:443 closed
    2017-09-25T02:26:36.112633-07:00  tomcat: [DefaultClientConnection] DEBUG: Connection 0.0.0.0:57992<->10.2.1.1:443 closed
    2017-09-25T02:26:36.112757-07:00  tomcat: [DefaultRequestDirector] INFO : I/O exception (org.apache.http.NoHttpResponseException) caught when processing request to {s}->https://host:443: The target server failed to respond
    

    即使进行了上述更改,我仍然会看到NoHttpResponse错误。我还可以尝试找出根本原因并修复它?

0 个答案:

没有答案