I have this piece of code that directly processes the response out of a REST client:
uc = (HttpURLConnection) u.openConnection();
uc.setConnectTimeout(2000);
uc.setDoOutput(true);
out = new OutputStreamWriter(uc.getOutputStream());
out.write(posturl);
out.flush();
rd = new BufferedReader(new InputStreamReader(uc.getInputStream()));
When I run this code (actually it is a jar run my a BPEL within OpenESB) I get the following exception:
java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext) cause java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext)
I'm not sure what's happening here let alone solve it. I guess this is related to the endpoint being a HTTPs server. I have little experience myself with HTTPs so I'm not sure what's the cause or what to do to fix it.
Full StackTrace (or as full as OpenESB offers):
java.net.SocketException: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext)
at javax.net.ssl.DefaultSSLSocketFactory.throwException(SSLSocketFactory.java:198)
at javax.net.ssl.DefaultSSLSocketFactory.createSocket(SSLSocketFactory.java:205)
at sun.net.www.protocol.https.HttpsClient.createSocket(HttpsClient.java:361)
at sun.net.NetworkClient.doConnect(NetworkClient.java:162)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:378)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:473)
at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:270)
at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:327)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:931)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1090)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:250)
at es.myapp.OpenAMRESTAuthentication.readURLResponse(OpenAMRESTAuthentication.java:157)
at es.myapp.OpenAMRESTAuthentication.authenticate(OpenAMRESTAuthentication.java:60)
at es.myapp.OpenAMRESTAuthentication.authenticate(OpenAMRESTAuthentication.java:94)
at es.myapp.AuthSingleton.authenticate(AuthSingleton.java:82)
HttpsURLConnection. Can u typecast u.open connection toHttpsURLConnectionand try.