Hi all, I got a questing regarding using HttpClient from an MDB inside
Jboss.
Normal http connections work fine, but whenever I try to connect to a host
using https I get a SocketException, claiming SSL is not available:

12:13:39,338 INFO  [STDOUT] 2004-04-21 12:13:39,322     ERROR
(HttpClientWrapper.java:120) Unable to connect to 'https://mail.yahoo.com'
java.net.SocketException: SSL implementation not available
        at
javax.net.ssl.DefaultSSLSocketFactory.createSocket([DashoPro-V1.2-120198])
        at
org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory.createSocket
(SSLProtocolSocketFactory.java:112)
        at
org.apache.commons.httpclient.HttpConnection$1.doit(HttpConnection.java:691)
        at
org.apache.commons.httpclient.HttpConnection$SocketTask.run(HttpConnection.j
ava:1299)
        at java.lang.Thread.run(Thread.java:534)
12:13:39,322 ERROR [HttpClientWrapper] Unable to connect to
'https://mail.yahoo.com'
java.net.SocketException: SSL implementation not available
        at
javax.net.ssl.DefaultSSLSocketFactory.createSocket([DashoPro-V1.2-120198])
        at
org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory.createSocket
(SSLProtocolSocketFactory.java:112)
        at
org.apache.commons.httpclient.HttpConnection$1.doit(HttpConnection.java:691)
        at
org.apache.commons.httpclient.HttpConnection$SocketTask.run(HttpConnection.j
ava:1299)
        at java.lang.Thread.run(Thread.java:534)

The code works fine outside Jboss so I suppose there something I need to do
in order to enable jsse for Jboss. The problem is that I do not have a clue
*how* to set it up! If anyone could help me it would be greatly appreciated.



I'm using Java 1.4_02, HttpClient 2.0-final and Jboss 3.2.3. I have also
tried to set the system property java.protocol.handler.pkgs to
"com.sun.net.ssl.internal.www.protocol" using:
String sRes =
System.setProperty("java.protocol.handler.pkgs","com.sun.net.ssl.internal.ww
w.protocol");

also I try to add a provider with:
Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());  

code looks like this:
          HttpClient httpClient = new HttpClient();
        httpClient.setConnectionTimeout(connectTimeout);
        httpClient.setTimeout(readTimeout);

          HttpMethod method = null;

        //debug
        System.setProperty("org.apache.commons.logging.Log",
"org.apache.commons.logging.impl.SimpleLog");
 
System.setProperty("org.apache.commons.logging.simplelog.showdatetime",
"true");
 
System.setProperty("org.apache.commons.logging.simplelog.log.httpclient.wire
", "debug");
 
System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.comm
ons.httpclient", "debug");


        String sRes =
System.setProperty("java.protocol.handler.pkgs","com.sun.net.ssl.internal.ww
w.protocol");
        int ret = Security.addProvider(new
com.sun.net.ssl.internal.ssl.Provider());  


        method = new GetMethod(url.toExternalForm());
        method.setFollowRedirects(true);

        //execute the method
        try{
            httpClient.executeMethod(method);  // here exception is thrown
            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());
        }

Kind regards,

Fredrik Bonde ~ Java Developer

 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to