You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by gilberto migliavacca <gb...@yahoo.it> on 2010/02/15 19:14:58 UTC

random error java.io.IOException: Stream closed

Hi

I created a web java application deployed in the tomcat server.
This web application sometimes calls a different web application
using the apache http client.

my code have the following main lines:

--------------------------------

....

HttpConnectionManagerParams params = new HttpConnectionManagerParams();
params.setConnectionTimeout(30 * 1000);
HttpConnectionManager httpConnectionManager = new
   SimpleHttpConnectionManager();
httpConnectionManager.setParams(params);

HttpClient client = new HttpClient(httpConnectionManager);

String request = <something>

PostMethod method = new PostMethod(request);

method.setRequestEntity(new StringRequestEntity(<something>));


statusCode = client.executeMethod(method);

String responseBody = method.getResponseBodyAsString();

....

--------------------------------


when I run a perfomance tool that execute the web application simulating
a lot of concurrent clients sometimes I have the following error:

--------------------------------


...Error calling '<external web application method>'
java.io.IOException: Stream closed
	at java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:145)
	at java.io.BufferedInputStream.read(BufferedInputStream.java:239)
	at org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:77)
	at org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:105)
	at
org.apache.commons.httpclient.HttpParser.parseHeaders(HttpParser.java:165)
	at
org.apache.commons.httpclient.HttpMethodBase.readResponseHeaders(HttpMethodBase.java:1790)
	at
org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1592)
	at
org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:995)
	at
org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397)
	at
org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)
	at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
	at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:324)
	at **.**.dao.HTTPDAO.<mymethodname>(HTTPDAO.java:122)


----------------------------------


I don't understand where is the problem

1) in the network?
2) in the external web application that cannot support a lot of clients?
3) in my web application? is it the code correct?


mainly my question is: when I have an error like the previous one what
action item I have to take?

thanks in advance for helping

regards

gilberto












---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org