Error accessing a Web Service with SSL

后端 未结 7 877
借酒劲吻你
借酒劲吻你 2020-12-29 09:59

I have a program that is supposed to send a file to a web service, which requires an SSL connection. I run the program as follows:

SET JAVA_HOME=C:\\Program         


        
相关标签:
7条回答
  • 2020-12-29 10:35

    I had a similar issue when my Batch application was trying to fetch data from Restful web service using Apache wink. I was using MyEclipse as my dev environment. And was using the jre provided by IBM webSphere 8.5. When I changed to Sun 1.6 jre, the issue got resolved.

    0 讨论(0)
  • 2020-12-29 10:38

    one may set these properties at WAS_HOME/*/java/jre/lib/security/java.security file by uncomenting the following JSSE props.

    Default JSSE socket factories

    ssl.SocketFactory.provider=com.ibm.jsse2.SSLSocketFactoryImpl ssl.ServerSocketFactory.provider=com.ibm.jsse2.SSLServerSocketFactoryImpl

    0 讨论(0)
  • 2020-12-29 10:42

    If your non IBM jre is sun, then it already comes with SSL classes implementation packaged along with it.

    It seems the IBM jre is not containing SSL implementation classes at all.

    0 讨论(0)
  • 2020-12-29 10:51

    Found this topic while searching for the same error message but found a different solution. To test a https REST service using the Apache Wink client:

    ClientConfig config = new ClientConfig();
    config.setBypassHostnameVerification(true);
    RestClient client = new RestClient(config);
    

    And set the Factory's empty:

    Security.setProperty("ssl.SocketFactory.provider", "");
    Security.setProperty("ssl.ServerSocketFactory.provider", "");
    

    My runtime is a standalone Camel test using IBM JRE 1.7 from IBM WebSphere v8.5.5.

    0 讨论(0)
  • 2020-12-29 10:52

    Try adding these two lines somewhere in your setup code:

    Security.setProperty("ssl.SocketFactory.provider", "com.ibm.jsse2.SSLSocketFactoryImpl");
    Security.setProperty("ssl.ServerSocketFactory.provider", "com.ibm.jsse2.SSLServerSocketFactoryImpl");
    
    0 讨论(0)
  • 2020-12-29 10:53

    Java only allows one SSL connection factory class for a JVM. If you are using a JDK thats shipped with WebSphere Application Server v6x/7x/8x or any other WebSphere server tools in Rational Application Developer, then those require IBM ( com.ibm.websphere.ssl.protocol.SSLSocketFactory ) specific class from WebSphere Application Server runtime. because the java security file has the JSSE socket factories set like below

    # Default JSSE socket factories
    #ssl.SocketFactory.provider=com.ibm.jsse2.SSLSocketFactoryImpl
    #ssl.ServerSocketFactory.provider=com.ibm.jsse2.SSLServerSocketFactoryImpl
    
    # WebSphere socket factories (in cryptosf.jar)
    ssl.SocketFactory.provider=com.ibm.websphere.ssl.protocol.SSLSocketFactory
    ssl.ServerSocketFactory.provider=com.ibm.websphere.ssl.protocol.SSLServerSocketFactory
    

    So, If you uncomment the Default JSSE Socket factories and comment out the WebSphere ones then WAS is going to puke.

    Better work around would be to have com.ibm.ws.security.crypto.jar file in your class path. This jar file has a dependency on com.ibm.ffdc.jar file so you need that in your class path well. Both these jarfiles are available under <WebSphere_Install_Dirctory>/plugins/

    0 讨论(0)
提交回复
热议问题