Hi,
got a problem using jakarta-commons-HttpClient together with SSL from my bean, have a feeling the jsse stuff isn't properly initialised. I also tried to use a javax.net.ssl.HttpsURLConnection with the same result.
Whenever i try to create a socket I get a SocketException:
15:23:49,960 ERROR [STDERR] java.net.SocketException: SSL implementation not available
15:23:49,960 ERROR [STDERR] at javax.net.ssl.DefaultSSLSocketFactory.createSocket([DashoPro-V1.2-120198])
15:23:49,960 ERROR [STDERR] at com.digitalrum.maitai.common.http.HttpClientWrapper.doGet(HttpClientWrapper.java:113)
The test code I'm using is:
----------------------------------------------
URL url = new URL("https://xxx.xxxx.xxx");
HttpMethod method = null;
String oldProtocol = null;
int ret = Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
String handlers = System.getProperty("java.protocol.handler.pkgs");
if( handlers == null || handlers.indexOf("com.sun.net.ssl.internal.www.protocol") < 0 ) {
handlers += "|com.sun.net.ssl.internal.www.protocol";
System.setProperty("java.protocol.handler.pkgs", handlers);
}
method = new GetMethod(url.toExternalForm());
method.setFollowRedirects(true);
//execute the method
try{
httpClient.executeMethod(method); //exception thrown here!!
String res = method.getResponseBodyAsString();
method.releaseConnection();
return res;
} catch (HttpException e) {
_log.error("Http error connecting to '" + url + "'", e);
throw new HttpClientException(e.getMessage());
} catch (IOException e){
_log.error("Unable to connect to '" + url + "'", e);
throw new HttpClientException(e.getMessage());
}