hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Zdila <m.zd...@mwaysolutions.com>
Subject HttpClient 4, I/O exception and
Date Wed, 04 Jun 2008 07:40:44 GMT
Hello

I am using HttpClient 4.0-alpha4 with following settings:

~~~~~~~~~~~~
final HttpParams params = new BasicHttpParams();
HttpConnectionManagerParams.setMaxTotalConnections(params, 100);
HttpConnectionManagerParams.setMaxConnectionsPerRoute(params, new ConnPerRouteBean(20));
HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
HttpClientParams.setRedirecting(params, false);

final ClientParamBean paramBean = new ClientParamBean(params);
paramBean.setAllowCircularRedirects(true);
paramBean.setHandleAuthentication(false);
paramBean.setHandleRedirects(false);

// Create and initialize scheme registry
final SchemeRegistry schemeRegistry = new SchemeRegistry();
schemeRegistry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
schemeRegistry.register(new Scheme("https", SSLSocketFactory.getSocketFactory(), 443));

final ClientConnectionManager connectionManager = new ThreadSafeClientConnManager(params,
schemeRegistry);

client = new DefaultHttpClient(connectionManager, params);
((DefaultHttpClient) client).setCookieStore(null); // i don't wan't cookies
((DefaultHttpClient) client).setCookieSpecs(null); // i don't wan't cookies
~~~~~~~~~~~~

I see often in the logs following messages after executing HTTP method:

INFO org.apache.http.impl.client.DefaultClientRequestDirector - I/O exception (org.apache.http.NoHttpResponseException)
caught when processing request: The target server failed to 
respond
INFO org.apache.http.impl.client.DefaultClientRequestDirector - Retrying request

For HttpGet it finally ends with success, but when this messages appears on HttpPost then
it ends with following exception:

Caused by: org.apache.http.ProtocolException: Content-Length header already present
	at org.apache.http.protocol.RequestContent.process(RequestContent.java:70)
	at org.apache.http.protocol.BasicHttpProcessor.process(BasicHttpProcessor.java:290)
	at org.apache.http.protocol.HttpRequestExecutor.preProcess(HttpRequestExecutor.java:160)
	at org.apache.http.impl.client.DefaultClientRequestDirector.execute(DefaultClientRequestDirector.java:356)
	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:501)
	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:456)
	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:422)
...

Is that a bug? Is there a way to resolve this issue?

Thanks in advance.
Best regards

-- 
Martin Zdila 
CTO

M-Way Solutions Slovakia s.r.o.
Letna 27, 040 01 Kosice
Slovakia

tel:+421-908-363-848
mailto:m.zdila@mwaysolutions.com
http://www.mwaysolutions.com
xmpp:zdila@jabbim.sk (Jabber)
skype:m.zdila

Mime
View raw message