You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Zulfi Umrani <zu...@novell.com> on 2004/10/08 19:53:10 UTC

redirect problem in HttpClient

I am getting the following exception for redirect responses from
HttpClient. Attached is the log from HttpClient. I know that HttpClient
does not support redirect directly, hence we have written some code to
handle that. The problem seems to be that, occasionally HttpClient does
not send the request body though it writes out the Content-Length
header. If you send the same request one after another by starting a new
JVM for each request, such as running a client from commandline, you
will see that, it sends the request body for a few times and then it
does not send it once and then it starts to send it again. This behavior
keeps repeating. Below is the request sent out by HttpClient and
response received by it, captured through a tunnel. I will appreciate if
someone can explain the behavior.

Exception in thread "main" java.rmi.RemoteException:
java.net.SocketException: S
oftware caused connection abort: recv failed; nested exception is:
        org.apache.commons.httpclient.HttpRecoverableException:
java.net.SocketE
xception: Software caused connection abort: recv failed
        at
com.sssw.jbroker.web.ServiceException.mapToRemote(ServiceException.ja
va:92)
        at hello.HelloBinding_Stub.sayHello(HelloBinding_Stub.java:85)
        at hello.Client.main(Client.java:25)
Caused by: org.apache.commons.httpclient.HttpRecoverableException:
java.net.Sock
etException: Software caused connection abort: recv failed
        at
org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodB
ase.java:1965)
        at
org.apache.commons.httpclient.HttpMethodBase.processRequest(HttpMetho
dBase.java:2659)
        at
org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.j
ava:1093)
        at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.jav
a:675)
        at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.jav
a:558)

Request going out from HttpClient:
POST /services/hello HTTP/1.1 
SOAPAction: "http://www.hello/sayHello" 
Content-Type: text/xml; charset=utf-8 
Connection: keep-alive 
User-Agent: Jakarta Commons-HttpClient/2.0final 
Host: 840serv7:54892
Content-Length: 421 

Response received by HttpClient:
HTTP/1.1 307 redirected 
Set-Cookie: dispatch-http-rt=840serv7:80; path=/; 
Content-Length: 0 
Location: http://840serv7:80/services/hello

Thanks,
Zulfi

Re: redirect problem in HttpClient

Posted by Oleg Kalnichevski <ol...@apache.org>.
Zulfi

HttpRecoverableException: "Software caused connection abort: recv
failed" usually means that the connection was closed on the server side
while HttpClient was still reading the response. The is more likely to
be the server side problem. 

What exactly do you mean by "occasionally HttpClient does not send the
request body". Does it throw an exception, or blocks, or something else?

Oleg
 

On Fri, 2004-10-08 at 19:53, Zulfi Umrani wrote:
> I am getting the following exception for redirect responses from
> HttpClient. Attached is the log from HttpClient. I know that HttpClient
> does not support redirect directly, hence we have written some code to
> handle that. The problem seems to be that, occasionally HttpClient does
> not send the request body though it writes out the Content-Length
> header. If you send the same request one after another by starting a new
> JVM for each request, such as running a client from commandline, you
> will see that, it sends the request body for a few times and then it
> does not send it once and then it starts to send it again. This behavior
> keeps repeating. Below is the request sent out by HttpClient and
> response received by it, captured through a tunnel. I will appreciate if
> someone can explain the behavior.
> 
> Exception in thread "main" java.rmi.RemoteException:
> java.net.SocketException: S
> oftware caused connection abort: recv failed; nested exception is:
>         org.apache.commons.httpclient.HttpRecoverableException:
> java.net.SocketE
> xception: Software caused connection abort: recv failed
>         at
> com.sssw.jbroker.web.ServiceException.mapToRemote(ServiceException.ja
> va:92)
>         at hello.HelloBinding_Stub.sayHello(HelloBinding_Stub.java:85)
>         at hello.Client.main(Client.java:25)
> Caused by: org.apache.commons.httpclient.HttpRecoverableException:
> java.net.Sock
> etException: Software caused connection abort: recv failed
>         at
> org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodB
> ase.java:1965)
>         at
> org.apache.commons.httpclient.HttpMethodBase.processRequest(HttpMetho
> dBase.java:2659)
>         at
> org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.j
> ava:1093)
>         at
> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.jav
> a:675)
>         at
> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.jav
> a:558)
> 
> Request going out from HttpClient:
> POST /services/hello HTTP/1.1 
> SOAPAction: "http://www.hello/sayHello"
> Content-Type: text/xml; charset=utf-8 
> Connection: keep-alive 
> User-Agent: Jakarta Commons-HttpClient/2.0final 
> Host: 840serv7:54892
> Content-Length: 421 
> 
> Response received by HttpClient:
> HTTP/1.1 307 redirected 
> Set-Cookie: dispatch-http-rt=840serv7:80; path=/; 
> Content-Length: 0 
> Location: http://840serv7:80/services/hello
> 
> Thanks,
> Zulfi
> 
> ______________________________________________________________________
> ---------------------------------------------------------------------
> 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