Fredrik,

This problem is clearly not HttpClient related, hence you have not been getting a lot 
of responses. HttpClient simply expects JSSE to be there and be properly configured in 
order for the HTTPS support to be functional. Please take a look at the HttpClient SSL 
guide paying special attention to the troubleshooting section

<http://jakarta.apache.org/commons/httpclient/sslguide.html>

Hope this helps a little

Oleg


-----Original Message-----
From: Fredrik Bonde [mailto:[EMAIL PROTECTED]
Sent: Wednesday, April 21, 2004 13:18
To: '[EMAIL PROTECTED]'
Subject: Problems using SSL from inside JBoss (jsse problem?)


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]


***************************************************************************************************
The information in this email is confidential and may be legally privileged.  Access 
to this email by anyone other than the intended addressee is unauthorized.  If you are 
not the intended recipient of this message, any review, disclosure, copying, 
distribution, retention, or any action taken or omitted to be taken in reliance on it 
is prohibited and may be unlawful.  If you are not the intended recipient, please 
reply to or forward a copy of this message to the sender and delete the message, any 
attachments, and any copies thereof from your system.
***************************************************************************************************

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

Reply via email to