1

Hi we have a problem with our WAS 7.5 production environment, we are getting the following error with an application that had implemented google recaptcha:

javax.net.ssl.SSLException: SSLSocketFactory is null. This can occur if javax.net.ssl.SSLSocketFactory.getDefault() is called to create a socket and javax.net.ssl.* properties are not set.

We have the following code:

System.setProperty("javax.net.ssl.keyStoreType","jks");
System.setProperty("javax.net.ssl.trustStoreType","jks");
System.setProperty("javax.net.ssl.keyStore","/jks/ClientKeyStore.jks");
System.setProperty("javax.net.ssl.trustStore","/jks/ClientTrustStore.jks");
System.setProperty("javax.net.debug","ssl");
System.setProperty("javax.net.ssl.keyStorePassword","password$");
System.setProperty("javax.net.ssl.trustStorePassword","password$");

SSLSocketFactory sslsocketfactory = (SSLSocketFactory) 
SSLSocketFactory.getDefault();

In our certification environment everything is working fine, anyone had a similar issue ? thanks in advance.

  • How are you creating the `SSLSocketFactory`? – Misantorp Mar 19 '19 at 19:05
  • Hello yes we have the following code: SSLSocketFactory sslsocketfactory = (SSLSocketFactory) SSLSocketFactory.getDefault(); URL obj = new URL(url); HttpsURLConnection con = (HttpsURLConnection) obj.openConnection(); con.setSSLSocketFactory(sslsocketfactory); – user3813524 Mar 20 '19 at 23:50
  • I'd encourage you to update the question with that information in addition to how the related `javax.net.ssl.*` properties are set. Without that information there is really not that much anybody can do to help – Misantorp Mar 21 '19 at 06:17

1 Answers1

1

The problem was resolved editing the java.security file of JRE, changing the following lines:

# 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

After the app severs were restarted the recaptcha code works.