4

Iam using HTTPClient 4.0 to connect a remote server and transfer file using HTTPS. When i tried to connect i get the exception "java.net.SocketException: Unconnected sockets not implemented". Please look at the stack trace

java.net.SocketException: Unconnected sockets not implemented 
at java.lang.Throwable.<init>(Throwable.java:196) 
at java.lang.Exception.<init>(Exception.java:41) 
at java.io.IOException.<init>(IOException.java:40) 
at java.net.SocketException.<init>(SocketException.java:29) 
at javax.net.SocketFactory.createSocket(SocketFactory.java:2) 
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
at java.lang.reflect.Method.invoke(Method.java:585) 
at org.apache.commons.httpclient.protocol.ReflectionSocketFactory.createSocket(Unknown Source) 
at org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory.createSocket(Unknown Source) 
at org.apache.commons.httpclient.HttpConnection.open(Unknown Source) 
at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(Unknown Source) 
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(Unknown Source) 
at org.apache.commons.httpclient.HttpClient.executeMethod(Unknown Source) 
at org.apache.commons.httpclient.HttpClient.executeMethod(Unknown Source) 
at co.com.personalsoft.ftpseguro.utilidades.TransmisionHTTP.ejecutarTransmisionHTTP(TransmisionHTTP.java:107) 
at co.com.personalsoft.ftpseguro.utilidades.TransmisionFTPNew.ejecutarTransmisionAuto(TransmisionFTPNew.java:483) 
at co.com.personalsoft.ftpseguro.utilidades.TransmisionFTPNew.ejecutarTransmision(TransmisionFTPNew.java:1016) 
at co.com.personalsoft.ftpautomatico.ConexionThread.run(ConexionThread.java:58) 
at java.lang.Thread.run(Thread.java:595) 

The same error is found while using HTTP Client 3.1.

My Environment Application Server : Websphere application server 6.1.0.23 Java : JDK 1.5.0.16

Suppressingfire
  • 3,246
  • 23
  • 17
shyam sundar
  • 41
  • 1
  • 1
  • 2
  • 1
    Does it work outside websphere? Perhaps websphere replaces the socket factory? – bmargulies Nov 15 '09 at 22:39
  • 2
    this is working in websphere application server 5.1 The error is found only in WAS 6.1 – shyam sundar Nov 16 '09 at 20:30
  • I'm seeing this under RAD 7.0 and a WAS 6.1 test environment. The same exact code works when I launch it using the latest JDK, but whatever version is used in the WAS 6.1 test environment fails. It seems to be related to the specific JDK version: http://old.nabble.com/Unconnected-sockets-not-implemented-td19107059.html and http://stackoverflow.com/questions/116635/socketexception-unconnected-sockets-not-implemented-with-self-signed-ssl-certi – Suppressingfire Dec 08 '09 at 16:48

2 Answers2

1

Actually a more complete answer than suppressingfire is

  1. Add com.ibm.ws.admin.client_7.0.0.jar to java build

    This solves the java.lang.NoClassDefFoundError: com.ibm.ffdc.Manager error.

  2. Add to setup:

    import java.security.Security;
    ...
    Security.setProperty("ssl.SocketFactory.provider", "com.ibm.jsse2.SSLSocketFactoryImpl");
    

    This solves the Cannot find the specified class com.ibm.websphere.ssl.protocol.SSLSocketFactory

thkala
  • 84,049
  • 23
  • 157
  • 201
Albert T. Wong
  • 1,535
  • 1
  • 13
  • 21
0

When I enabled javax.net.debug, I noticed that there was a missing class com.ibm.websphere.com.ibm.websphere.ssl.protocol.SSLSocketFactory.

I was experiencing trouble in unit tests that invoke httpclient. What I ended up doing was to add this line to my TestClass.setUp()

Security.setProperty("ssl.SocketFactory.provider", "com.ibm.jsse2.SSLSocketFactoryImpl");
Suppressingfire
  • 3,246
  • 23
  • 17