Hi Oleg,

Thank you for the info.  I'll try this one out and will let you know.

Thanks a bunch.

Dennis

-----Original Message-----
From: Oleg Kalnichevski [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 25, 2004 8:47 AM
To: Commons HttpClient Project
Subject: RE: HttpRecoverableException


Hi Dennis,

> 2004/08/19 11:56:07:490 CDT [WARN] MainMenu - -Web Service Exception:
> > he.commons.httpclient.HttpRecoverableException: Error in parsing the
> > status  line from the response: unable to find line starting with "HTTP"

Usually this happens when the web servers being under heavy load is able
to receive requests but unable to process them, for instance, due to
inability to allocate sufficient resources such as worker threads. This
may cause the server to drop the connection to the client without giving
any response back.


I can think of two things that may help you work the problem around

(1) increase the number of retries
(2) introduce a delay between the retries

=================================================================
HttpClient httpclient = new HttpClient();
GetMethod httpget = new GetMethod("http://www.whatever.com/stuff";);
httpget.setMethodRetryHandler(new MethodRetryHandler() {

    public boolean retryMethod(
            HttpMethod method,

            HttpConnection connection,
            HttpRecoverableException recoverableException,
            int executionCount,
            boolean requestSent) {
        if (executionCount < 10) {
                try {
                        Thread.sleep(100);
                } catch (InterruptedException ignore) {
                }
                return true;
        } else {
                return false;
        }
    }


});
try {
        httpclient.executeMethod(httpget);
        System.out.println(httpget.getStatusLine());

        System.out.println(httpget.getResponseBodyAsString());

} finally {
        httpget.releaseConnection();
}
=================================================================

See if that helps

Oleg



On Fri, 2004-08-20 at 18:50, Labajo, Dennis wrote:
> Hi Ortwin,
>

> Thank you for your reply.  I've answered your questions below:
>

> 1.  Why does the method need to be retried in the first place?
>

> Answer:
>

> We've been getting "HttpRecoverableException" and I've initially coded a custom 
> retry for handling these types of exceptions.  However, I came across an info 
> somewhere that suggests using DefaultMethodRetryHandler in lieu of a custom retry 
> which works perfectly.
>

>

> 2.  Which version of HttpClient are you using?
>

> Answer:
>

> commons-httpclient-2.0.1
>

>

>

> 3. Is it an authentication problem?
>

> Answer:
>

> No.  We can see in the log file authentication works just fine.
>

>

>

> 4. Are you using proxy by any chance?
>

> Answer:
>

> No.  Computer that encountered this error connects to ISP via dialup.
> Computer in other locations that also uses dialup had no problem.
>

>

> 5. Are you opening many simultanous connections to the same host?
>

> Answer:
>

> Yes.  But currently while we're tracing the problem we've stripped it down to not do 
> simultaneous connection.
>

>

> 6.  Which HTTP Version does the server use?
>

> Answer:
>

> HTTP 1.1
>

>

>

> 7.  Can you provide a wire log or packet log of the communication?
>

> Answer?
>

> Sure!  How do I do that?  I've attached a text file of what I think you may be 
> looking for.
>

> At line 137 the HTTPRecoverable exception first occurs and then goes on for two more 
> then the exception is thrown.
>

>

>

> More info:
>

> Computer was on a dialup connection to an ISP.  Other locations also are on dialup 
> but different ISP but works just fine.  Operating system is Windows is 98. 

>

>

> Any help is greatly appreciated.
>

> Thanks.
>

> Dennis
>

>

>

>

>

> -----Original Message-----
> From: Ortwin Glück [mailto:[EMAIL PROTECTED]

> Sent: Friday, August 20, 2004 1:52 AM
> To: Commons HttpClient Project
> Subject: Re: HttpRecoverableException
>

> Dennis,
>

> The question is, why does the method need to be retried in the first

> place. You should avoid having to retry expensive methods like POST and

> PUT normally. Furthermore a lot of questinos arise here:
>   * Which version of HttpClient are you using?
>   * Is it an authentication problem? (would expect a different exception)
>   * Are you using a proxy by any chance?
>   * Are you opening many simultanous connections to the same host?
>   * Which HTTP Version does the server use?
>   * Can you provide a wire log or packet log of the communication?
>

> Thanks
>

> Ortwin Glück
>

> Labajo, Dennis wrote:
> > 

> >

> > Hi all.
> >

> > 

> >

> > I badly need help on an error (HttpRecoverableException) I'm getting.
> > Here's part of my java source code:
> >

> > 

> >

> > 

> >

> > << the class where httpclient instance is created >>
> >

> > 

> >

> > MultiThreadedHttpConnectionManager cmgr = new
> >

> >       MultiThreadedHttpConnectionManager();
> >

> > cmgr.setConnectionStaleCheckingEnabled( true );
> >

> > cmgr.setMaxConnectionsPerHost( 10 );
> >

> > cmgr.setMaxTotalConnections( 100 );
> >

> > HttpClient httpclient = new HttpClient(cmgr);
> >

> > httpclient.setConnectionTimeout(30000);
> >

> > httpclient.setTimeout(30000);
> >

> > httpclient.setState( this.commonHttpState);
> >

> > 

> >

> > 

> >

> > 

> >

> > << class where httppost is made >>
> >

> > 

> >

> > DefaultMethodRetryHandler methodretry = new DefaultMethodRetryHandler();
> >

> > methodretry.setRequestSentRetryEnabled(true);
> >

> > PostMethod httppost = new PostMethod(this.server_url.toString());
> >

> > httppost.setMethodRetryHandler(methodretry);
> >

> > httpClient.executeMethod(httppost);
> >

> > 

> >

> > 

> >

> > 

> >

> > I do see the recoverable exception caught three times:
> >

> >

> >

> > 2004/08/19 11:55:44:650 CDT [INFO] HttpMethodBase - -Recoverable
> > exception caught when processing request
> >

> > 

> >

> > But on the fourth recoverable exception, I get this:
> >

> > 

> >

> > 2004/08/19 11:56:07:440 CDT [WARN] HttpMethodBase - -Recoverable
> > exception caught but MethodRetryHandler.retryMethod() returned false,
> > rethrowing exception
> >

> > 2004/08/19 11:56:07:440 CDT [DEBUG] MultiThreadedHttpConnectionManager -
> > -Freeing connection,
> > hostConfig=HostConfiguration[host=nwapeople2.nwa.com,
> > protocol=https:443, port=443]
> >

> > 2004/08/19 11:56:07:440 CDT [DEBUG] MultiThreadedHttpConnectionManager -
> > -Notifying no-one, there are no waiting threads
> >

> > 2004/08/19 11:56:07:490 CDT [WARN] MainMenu - -Web Service Exception:
> > he.commons.httpclient.HttpRecoverableException: Error in parsing the
> > status  line from the response: unable to find line starting with "HTTP"
> >

> > 

> >

> > 

> >

> > 

> >

> > Is there something I'm not doing right?

> >

> > 

> >

> > Thanks.
> >

> > 

> >

> > Dennis
> >

> > 

> >

> > 

> >

> > 

> >

> >


***************************************************************************************************
The information in this email is confidential and may be legally privileged.  Access 
to this email by anyone other than the intended addressee is unauthorized.  If you are 
not the intended recipient of this message, any review, disclosure, copying, 
distribution, retention, or any action taken or omitted to be taken in reliance on it 
is prohibited and may be unlawful.  If you are not the intended recipient, please 
reply to or forward a copy of this message to the sender and delete the message, any 
attachments, and any copies thereof from your system.
***************************************************************************************************

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to