HttpClientError: The target server failed to respond

前端 未结 2 1013
南方客
南方客 2020-12-29 10:12

I am trying to hit a server using http client using PoolingClientConnectionManager setting max connections for individual hosts

 //Code that ini         


        
相关标签:
2条回答
  • 2020-12-29 10:24

    Recently faced similar while using HttpClient 5.

    On enabling the HttpClient logs and found that the issue was due to stale connections.

    Adding the below helped to solve the issue, it detects and validates the connections that have become stale while kept inactive in the pool before reuse.

    PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager();
    
    connectionManager.setValidateAfterInactivity(timeinmilliseconds);
    
    0 讨论(0)
  • 2020-12-29 10:29

    Probably, it is a bug in the HttpClient.

    If you are using the HttpClient 4.4, please try to upgrade to 4.4.1.

    If you want for more information, please look at this link.

    If you can't upgrade, the following links might be helpful.

    http://www.nuxeo.com/blog/using-httpclient-properly-avoid-closewait-tcp-connections/

    Good luck!

    0 讨论(0)
提交回复
热议问题