You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Ra...@spb.de on 2004/04/05 12:12:08 UTC

[HTTP Client] Exception "java.net.SocketException: Socket closed" while processing HTTPS request

Hello,

I'm experiencing a problem while processing a HTTPS Get Request with HTTP
Client and IBM JSSE 1.4 (part of WebSphere App Server 5.0)
When working on plain secure sockets all works fine.
When I try do use HTTP Client the following exception occurs:

java.net.SocketException: Socket closed
        at java.net.PlainSocketImpl.socketGetOption(Native Method)
        at java.net.PlainSocketImpl.getOption(PlainSocketImpl.java:214)
        at java.net.Socket.getSendBufferSize(Socket.java:548)
        at
org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:720)
        at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:662)
        at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:529)
        at SSLTest2.main(SSLTest2.java:31)

My code is:
        [...]
        System.setProperty("java.protocol.handler.pkgs",
"com.ibm.net.ssl.internal.www.protocol");
        System.setProperty("javax.net.ssl.keyStorePassword", KEYSTOREPW);
        java.security.Security.addProvider(new com.ibm.jsse.IBMJSSEProvider
());

        try
        {
           HttpClient httpclient = new HttpClient();
           GetMethod httpget = new GetMethod(TARGET_HTTPS_URL);
           httpclient.executeMethod(httpget);
           System.out.println(httpget.getStatusLine().toString());
        }
        catch(Exception e)
        {
           e.printStackTrace();
        }
        [...]

The HTTP Client trace output looks like:

2004/04/05 11:34:52:031 CEST [TRACE] GetMethod - -enter GetMethod(String)
2004/04/05 11:34:52:031 CEST [TRACE] HttpClient - -enter
HttpClient.executeMethod(HttpMethod)
2004/04/05 11:34:52:031 CEST [TRACE] HttpClient - -enter
HttpClient.executeMethod(HostConfiguration,HttpMethod,HttpState)
2004/04/05 11:34:52:047 CEST [DEBUG] HttpConnection -
-HttpConnection.setSoTimeout(0)
2004/04/05 11:34:52:047 CEST [TRACE] HttpConnection - -enter
HttpConnection.open()
2004/04/05 11:34:54:688 CEST [TRACE] HttpConnection - -enter
HttpConnection.closeSockedAndStreams()
2004/04/05 11:34:54:688 CEST [TRACE] HttpConnection - -enter
HttpConnection.releaseConnection()

Can anyone help?
Thanks in advance.

Ralph Henze.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


RE: [HTTP Client] Exception "java.net.SocketException: Socket closed" while

Posted by ol...@bluewin.ch.
Ralph,
This is a known bug in the IBM JDK. Please make sure that your Websphere
application server has all the latest service packs applied. The bug is reported
to be have been fixed in WAS 5.0.2.2 and above.

Oleg

>-- Original Message --
>Reply-To: "Jakarta Commons Users List" <co...@jakarta.apache.org>
>To: commons-user@jakarta.apache.org
>From: Ralph.Henze@spb.de
>Date: Mon, 5 Apr 2004 12:12:08 +0200
>Subject: [HTTP Client] Exception "java.net.SocketException: Socket closed"
> 
>   while processing HTTPS request
>
>
>Hello,
>
>I'm experiencing a problem while processing a HTTPS Get Request with HTTP
>Client and IBM JSSE 1.4 (part of WebSphere App Server 5.0)
>When working on plain secure sockets all works fine.
>When I try do use HTTP Client the following exception occurs:
>
>java.net.SocketException: Socket closed
>        at java.net.PlainSocketImpl.socketGetOption(Native Method)
>        at java.net.PlainSocketImpl.getOption(PlainSocketImpl.java:214)
>        at java.net.Socket.getSendBufferSize(Socket.java:548)
>        at
>org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:720)
>        at
>org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:662)
>        at
>org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:529)
>        at SSLTest2.main(SSLTest2.java:31)
>
>My code is:
>        [...]
>        System.setProperty("java.protocol.handler.pkgs",
>"com.ibm.net.ssl.internal.www.protocol");
>        System.setProperty("javax.net.ssl.keyStorePassword", KEYSTOREPW);
>        java.security.Security.addProvider(new com.ibm.jsse.IBMJSSEProvider
>());
>
>        try
>        {
>           HttpClient httpclient = new HttpClient();
>           GetMethod httpget = new GetMethod(TARGET_HTTPS_URL);
>           httpclient.executeMethod(httpget);
>           System.out.println(httpget.getStatusLine().toString());
>        }
>        catch(Exception e)
>        {
>           e.printStackTrace();
>        }
>        [...]
>
>The HTTP Client trace output looks like:
>
>2004/04/05 11:34:52:031 CEST [TRACE] GetMethod - -enter GetMethod(String)
>2004/04/05 11:34:52:031 CEST [TRACE] HttpClient - -enter
>HttpClient.executeMethod(HttpMethod)
>2004/04/05 11:34:52:031 CEST [TRACE] HttpClient - -enter
>HttpClient.executeMethod(HostConfiguration,HttpMethod,HttpState)
>2004/04/05 11:34:52:047 CEST [DEBUG] HttpConnection -
>-HttpConnection.setSoTimeout(0)
>2004/04/05 11:34:52:047 CEST [TRACE] HttpConnection - -enter
>HttpConnection.open()
>2004/04/05 11:34:54:688 CEST [TRACE] HttpConnection - -enter
>HttpConnection.closeSockedAndStreams()
>2004/04/05 11:34:54:688 CEST [TRACE] HttpConnection - -enter
>HttpConnection.releaseConnection()
>
>Can anyone help?
>Thanks in advance.
>
>Ralph Henze.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: commons-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org