Thank you so much for replying. I walked through http-client code little bit to grasp this. Infact we are using this inside a message driven bean. However as per stack trace I think the socket was created within the connect timeout as otherwise the TimeoutController would have thrown exception (unless join(long) fails to exit) . Also within the http -client its sets the socket setSoTimeout(). At this point I beleive this could be an issue with IBM socket implementation.
The httpclient 3.0 is listed as beta1 in the web site. Please advise if this is production ready.
Regards,
kesavan
From: Oleg Kalnichevski <[EMAIL PROTECTED]> To: "Kesavan T.S" <[EMAIL PROTECTED]> Subject: Re: java.net.SocketException: SSL handshake failure Date: Wed, 19 Jan 2005 00:20:57 +0100
[I just realized you are not subscribed to the list]
Kesavan,
I am sorry none of us reacted sooner. The problem is that HttpClient 2.0.x is Java 1.2.x compatible and there's no (reliable) way to implement connect timeout prior to Java 1.4. Basically what HttpClient 2.0.x does to work the problem around is starting a controller thread that waits for connection request to complete within a given period of time. If connection cannot be established within the given time span, the controller simply drops the Socket on the floor (so to speak), throws an exception, and lets the garbage collector take care of the mess. This approach cannot be 100% reliable and to make matters worse is not compatible with EJB specification.
Please consider upgrading to HttpClient 3.0, which uses reflection to implement connect timeout when running in JVM 1.4 or above.
Hope this clarifies things a little
Oleg
On Tue, 2005-01-18 at 18:05 +0000, Kesavan T.S wrote:
> Hi ,
> Aoplogize for posting this again here which I had posted in dev list.Were
> using httpclient 2.02 on IBM Websphere 5.1. It works great but we get 3
> or 4 SocketException SSL Handshake failure per day (for about 5000-8000
> hits) which is ok. But the problem is we are using connection time out and
> read timeout but during these exception looks like the write is hanging for
> much more than the timeout.
> We are doing
>
> HttpClient httpClient = new HttpClient();
> GetMethod getMethod = new GetMethod(getURLString());
>
> httpClient.
> setConnectionTimeout(5000);
> httpClient.
> setTimeout(5000);
>
> try{
> int responseCode = httpClient.executeMethod(getMethod);
> Log.debug(this,"getData()","HTTP_RESPONSE_CODE = " +
> responseCode);
> is = getMethod.getResponseBodyAsStream();
>
> byte buf[] = new byte[4096];
> int nSize = is.read(buf);
> while(nSize>=0)
> {
> String data = new String(buf,0,nSize);
> sBuffer.append(data);
> nSize = is.read(buf);
> }
> }finally
> {
> if(is != null)is.close();
> getMethod.releaseConnection();
> }
> This is the exception and during this exceptin the httpclient hangs for more
> than 120 seconds:
>
> Caused by: java.net.SocketException: SSL handshake failure
> at com.ibm.sslite.m.c(Unknown Source)
> at com.ibm.sslite.m.f(Unknown Source)
> at com.ibm.sslite.m.a(Unknown Source)
> at com.ibm.sslite.n.<init>(Unknown Source)
> at com.ibm.sslite.be.a(Unknown Source)
> at com.ibm.sslite.be.<init>(Unknown Source)
> at com.ibm.jsse.bs.a(Unknown Source)
> at com.ibm.jsse.b.a(Unknown Source)
> at com.ibm.jsse.b.write(Unknown Source)
> at
> org.apache.commons.httpclient.HttpConnection$WrappedOutputStream.write(HttpConnection.java(Compiled
> Code))
> at
> java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java(Inlined
> Compiled Code))
> at java.io.BufferedOutputStream.flush(BufferedOutputStream.java(Compiled
> Code))
> at
> org.apache.commons.httpclient.HttpConnection.flushRequestOutputStream(HttpConnection.java(Inlined
> Compiled Code))
> at
> org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java(Compiled
> Code))
> at
> org.apache.commons.httpclient.HttpMethodBase.processRequest(HttpMethodBase.java(Compiled
> Code))
> at
> org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java(Compiled
> Code))
> at
> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java(Compiled
> Code))
> at
> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java(Compiled
> Code))
>
> I would really appreciate if someone can suggest how to resolve this to
> timeout properly.
> Regards,
> kesavan
>
>
>
> ---------------------------------------------------------------------
> 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]
