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 18:41:56 UTC

RE: HttpRecoverableException when using httpClient only in certai n situation

Hi Michael,

Thanks for your reply.  I was mistakenly submit the request twice - which
means that I am using the single instance for multiple thread!

There is another question about the log, I have setProperty for the log as
follows, but I don't see any output for httpClient ...  Why?

System.setProperty("org.apache.commons.logging.Log",
"org.apache.commons.logging.impl.SimpleLog");

System.setProperty("org.apache.commons.logging.simplelog.showdatetime",
"true");

System.setProperty("org.apache.commons.logging.simplelog.log.httpclient.wire
", "debug");

System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.comm
ons.httpclient", "debug");

 
System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.comm
ons.httpclient.Authenticator", "trace");
    System.setProperty("org.apache.commons.logging.simplelog.defaultlog",
"debug");

-----Original Message-----
From: Michael Becke [mailto:becke@u.washington.edu]
Sent: Tuesday, May 04, 2004 9:16 PM
To: Commons HttpClient Project
Subject: Re: HttpRecoverableException when using httpClient only in
certain si tuation


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

Re: HttpRecoverableException when using httpClient only in certai n situation

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

My guess is that Log4j is on your classpath.  Commons logging is really  
just a facade for other logging systems.  When log4j is present it will  
be deferred to for logging, including configuration.

Mike

On May 5, 2004, at 12:41 PM, Jing Chen wrote:

> Hi Michael,
>
> Thanks for your reply.  I was mistakenly submit the request twice -  
> which
> means that I am using the single instance for multiple thread!
>
> There is another question about the log, I have setProperty for the  
> log as
> follows, but I don't see any output for httpClient ...  Why?
>
> System.setProperty("org.apache.commons.logging.Log",
> "org.apache.commons.logging.impl.SimpleLog");
>
> System.setProperty("org.apache.commons.logging.simplelog.showdatetime",
> "true");
>
> System.setProperty("org.apache.commons.logging.simplelog.log.httpclient 
> .wire
> ", "debug");
>
> System.setProperty("org.apache.commons.logging.simplelog.log.org.apache 
> .comm
> ons.httpclient", "debug");
>
>
> System.setProperty("org.apache.commons.logging.simplelog.log.org.apache 
> .comm
> ons.httpclient.Authenticator", "trace");
>      
> System.setProperty("org.apache.commons.logging.simplelog.defaultlog",
> "debug");
>
> -----Original Message-----
> From: Michael Becke [mailto:becke@u.washington.edu]
> Sent: Tuesday, May 04, 2004 9:16 PM
> To: Commons HttpClient Project
> Subject: Re: HttpRecoverableException when using httpClient only in
> certain si tuation
>
>
> 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


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