Return-Path: Mailing-List: contact commons-httpclient-dev-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list commons-httpclient-dev@jakarta.apache.org Received: (qmail 75636 invoked from network); 23 May 2003 14:47:45 -0000 Received: from paysurfmta01.sunrise.ch (HELO paysurfmail.sunrise.ch) (194.230.0.20) by daedalus.apache.org with SMTP; 23 May 2003 14:47:45 -0000 Received: from SM001.diax.ch (195.112.95.126) by paysurfmail.sunrise.ch (6.0.055) id 3E4370F6001D85A5 for commons-httpclient-dev@jakarta.apache.org; Fri, 23 May 2003 16:47:17 +0200 Received: by SM001.diax.ch with Internet Mail Service (5.5.2653.19) id ; Fri, 23 May 2003 16:47:47 +0200 Message-ID: <00FC1A402EB17344A8265AA1E7DF460F01CC5953@sm002.diax.ch> From: "Walther, Benjamin" To: 'Commons HttpClient Project' Subject: RE: HttpClient stability issues? Date: Fri, 23 May 2003 16:47:44 +0200 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C3213A.451A7F10" X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N ------_=_NextPart_001_01C3213A.451A7F10 Content-Type: text/plain; charset="iso-8859-1" thanks guys, really active and helpful this list. ;) -----Original Message----- From: Max Johnson [mailto:max.johnson@flytxt.com] Sent: Freitag, 23. Mai 2003 14:56 To: Commons HttpClient Project; commons-user@jakarta.apache.org Subject: RE: HttpClient stability issues? You need to recycle your POST method before you perform a retry attempt. So your catch block would look something like this: catch (HttpRecoverableException e) { logInfo( "A recoverable exception occurred, retrying." + e); method.recycle(); method.setPath(url.toString()); } Alpha 3 build has problems though so it's worth upgrading to the latest nightly build too. Max -----Original Message----- From: Walther, Benjamin [mailto:Benjamin.Walther@sunrise.net] Sent: 23 May 2003 13:42 To: 'commons-httpclient-dev@jakarta.apache.org'; 'commons-user@jakarta.apache.org' Subject: HttpClient stability issues? Hi, I use httpclient like described in the tutorial. I have a session scoped class that creates a httpclient instance upon creation time. It then nvokes methods on this client instance. Unfortunately it behaves very unstable. I use the releasse 2.0 alpha 3 . When invoking the execute method i get IOException: broken pipe or org.apache.commons.httpclient.HttpException: Already used, but not recycled. Any idea? My code looks like: public void doPost(URL url, String postBody, Writer writer ) throws IOException { PostMethod method = new PostMethod(url.toString()); try { method.setRequestBody( postBody ); // Execute the method. int statusCode = -1; int attempt = 0; // We will retry up to 3 times. while (statusCode == -1 && attempt < 3) { try { // execute the method. statusCode = client.executeMethod(method); attempt++; } catch (HttpRecoverableException e) { logInfo( "A recoverable exception occurred, retrying." + e); } catch (IOException e) { logError("Failed to connect to url:"+url.toString()+" Error:"+e); throw e; } } // Check that we didn't run out of retries. if ( statusCode != HttpStatus.SC_OK){ if (statusCode == -1) { logError("Failed to recover from exception. See info.log"); } //Vitria sends only HttpStatus.SC_OK back when no error therefore no action here logInfo("Status from Vitria not OK(200). Status was:"+statusCode); } // Deal with the response. // Use caution: ensure correct character encoding and is not binary data copyStreamToCharWriter(method.getResponseBodyAsStream(), writer); logDebug( "HttpConnectionManager.doPost: Response from url:"+url.toString()+":"+writer.toString()); } finally { // Release the connection. method.releaseConnection(); } } --------------------------------------------------------------------- To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org ------_=_NextPart_001_01C3213A.451A7F10--