Hello,
Im occassionally getting the following error (HC 4.3.4)
There was no reply from the server
org.apache.http.NoHttpResponseException: 10.150.3.159:80 failed to respond
at
org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpRes
ponseParser.java:143)
at
org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpRes
ponseParser.java:57)
at
org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.ja
va:260)
at
org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(Defa
ultBHttpClientConnection.java:161)
at
org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:1
53)
at
org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestEx
ecutor.java:271)
at
org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.jav
a:123)
at
org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:25
4)
at
org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195)
at
org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:86)
at
org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.
java:184)
at
org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.
java:82)
at
org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.
java:106)
at
com.ventusproxy.proxy.services.http.HttpInstance.sendRequest(HttpInstance.ja
va:610)
( . . . )
Ive read some posts about it. It seems that the main reason is that
keep-alive connections are dropped on the server side. In my case I dont
have keep alive enabled (every request initiates a new connection to the
server). Furthermore I have the following retryHandler:
public class RequestRetryHandler implements HttpRequestRetryHandler
{
private int maxExecutionCount;
public RequestRetryHandler(int maxExecutionCount) {
this.setMaxExecutionCount(maxExecutionCount); }
public void setMaxExecutionCount(int maxExecutionCount) {
this.maxExecutionCount = maxExecutionCount; }
public boolean retryRequest(IOException exception, int executionCount,
HttpContext context)
{
if (executionCount > this.maxExecutionCount) return false;
if ( (exception instanceof InterruptedIOException) || (exception
instanceof UnknownHostException) || (exception instanceof ConnectException)
|| (exception instanceof SSLException) ) return false;
return (!(HttpClientContext.adapt(context).getRequest() instanceof
HttpEntityEnclosingRequest));
}
}
I realize its a server problem (its probably dropping connections), but is
there anything else I can do to minimize this error (in addition to disable
keepAlive and enable a retryHandler)?
Thanks,
Joan.