I am facing the following SSL
connection exception
when trying to connect to remote server:
java.net.SocketException: Default SSL context init failed: null
Most of the thread suggest that there is some problem with the keystore
location that contains the certificate
file.
Others like this post: Default SSL context init failed: null suggests is to create the SSL Context
by yourself. But, again the issue is not resolved yet.
And here is what I did so far:
I tried to add certificate
to the following file locations and all of them gave me the same error mentioned earlier:
• Cacerts
file in Java Home
.
• Default cacerts
location for the IDE
I am using (JDveloper 10.1.3.2
) which is in my case : C:\JDeveloper\WorkSpace_10g\jdevstudio10132\jdk\jre\lib\security\cacerts
• New keystore
that only contains this certificate
.
The certificated
is added using Portecle
applet( I also tried keytool
options from Command prompts
)
I am also referring to the trustStore
and keyStore
in the code as follow:
System.setProperty("javax.net.ssl.trustStore", trustStore file path goes here);
System.setProperty("javax.net.ssl.trustStorePassword", password goes here);
System.setProperty("javax.net.ssl.keyStore", keyStore file path goes here);
System.setProperty("javax.net.ssl.keyStorePassword", password goes here);
In the above code the file path
refer for the cacerts
files mentioned earlier (Java home
, default JDeveloper
cacerts
and newly created keystore
) of course I tried each one separately.