It might help with debugging arbitrary NonRepeatableRequestExceptions if it somehow captured the original exception that triggered the retry and added it to the cause. Think this has any merit (or is it even possible with the current code structure)?
Sam On Tue, Mar 24, 2009 at 9:37 AM, Oleg Kalnichevski <[email protected]> wrote: > On Tue, 2009-03-24 at 08:51 +0530, Subhash Chandran wrote: >> We are getting this Exception: >> >> <quote> >> Exception in thread "main" org.apache.http.client.ClientProtocolException >> at >> org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:557) >> at >> org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487) >> at >> org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465) >> at it.sella.iq.Main.main(Main.java:63) >> Caused by: org.apache.http.client.NonRepeatableRequestException: >> Cannot retry request with a non-repeatable request entity >> at >> org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:402) >> at >> org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555) >> ... 3 more >> </quote> >> >> when we are trying to send Multi-part messages like this: >> >> <quote> >> File f = ...; >> DefaultHttpClient httpclient = new DefaultHttpClient(); >> >> MultipartEntity entity = new MultipartEntity(); >> >> entity.addPart("file", new InputStreamBody(new FileInputStream(f), >> f.getName())); >> </quote> >> >> We tried adding: >> >> <quote> >> httpclient.setHttpRequestRetryHandler(new >> DefaultHttpRequestRetryHandler(0, false)); >> </quote> >> >> This also does not help. How do we fix this? >> >> Additional Info: when we are using FileBody instead of >> InputStreamBody, the code is working fine. >> > > This exception makes perfect sense. FileBody is repeatable, as a File > can be read from multiple times. InputStreamBody is not repeatable, > because an InputStream can be read from only once. > > You basically have two options: (1) use repeatable ContentBody > implementations only or (2) make sure the request does not need to be > retried. Please note the latter is not always possible. Request retries > due to authentication failures can be avoided, but those due to I/O > errors cannot. > > Hope this helps. > > Oleg > > > > --------------------------------------------------------------------- > 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]
