You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Jing Chen <jc...@centor.com> on 2004/05/05 00:39:22 UTC

HttpRecoverableException when using httpClient only in certain si tuation

Hi,

I am writing a web application using httpClient to connect to an existing
web application.  On the main menu, if I click a button, it is going to
create a httpClient (and save the httpClient into session), then invoke
process1 then process2, and pop up a new window to display the results.
Both process1 and process2 use the httpClient to do a Get or Post method.
(If I click some other button, which will do process1 and process3 through
httpClient without any problem.....)

Then, on the new window, there is a button that will trigger the same thing
- by clicking it, it will invoke process1 and process2.  Both process1 and
process2 are using the same client as before because the client comes from
the session.  

However, the process1 first get a recoverable exception:
org.apache.commons.httpclient.HttpRecoverableException:
java.net.SocketException: Socket closed 

then the httpclient retries, and got another recoverable exception:
org.apache.commons.httpclient.HttpRecoverableException: Error in parsing the
status  line from the response: unable to find line starting with "HTTP" 

I don't understand why I have a problem using httpClient in one situation
while no problem in another.  Seems that anything starts from the main menu
will be fine.  Isn't that wierd?

Please help ...

Thanks

Re: HttpRecoverableException when using httpClient only in certain si tuation

Posted by Michael Becke <be...@u.washington.edu>.
Hi Jing,

Are you using one instance of HttpClient from multiple threads?  If so, 
makes sure you have a look at 
<http://jakarta.apache.org/commons/httpclient/threading.html>.  If the 
problems continue please post some sample code and a wire log 
<http://jakarta.apache.org/commons/httpclient/logging.html>.

Mike

On May 4, 2004, at 6:39 PM, Jing Chen wrote:

> Hi,
>
> I am writing a web application using httpClient to connect to an 
> existing
> web application.  On the main menu, if I click a button, it is going to
> create a httpClient (and save the httpClient into session), then invoke
> process1 then process2, and pop up a new window to display the results.
> Both process1 and process2 use the httpClient to do a Get or Post 
> method.
> (If I click some other button, which will do process1 and process3 
> through
> httpClient without any problem.....)
>
> Then, on the new window, there is a button that will trigger the same 
> thing
> - by clicking it, it will invoke process1 and process2.  Both process1 
> and
> process2 are using the same client as before because the client comes 
> from
> the session.
>
> However, the process1 first get a recoverable exception:
> org.apache.commons.httpclient.HttpRecoverableException:
> java.net.SocketException: Socket closed
>
> then the httpclient retries, and got another recoverable exception:
> org.apache.commons.httpclient.HttpRecoverableException: Error in 
> parsing the
> status  line from the response: unable to find line starting with 
> "HTTP"
>
> I don't understand why I have a problem using httpClient in one 
> situation
> while no problem in another.  Seems that anything starts from the main 
> menu
> will be fine.  Isn't that wierd?
>
> Please help ...
>
> Thanks


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org