0 Replies Latest reply on Apr 26, 2004 6:28 AM by fredrik70

    Problem making SSL request from bean in JBoss 3.2.3

    fredrik70 Newbie

      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());
       }
      


      basically nothing fancy, the code works fine outside Jboss so I suspect there's something wrong with my jboss setup. I'm using is Jboss version 3.2.3 and java version 1.4.2_04. Have found nothing on the net at all about this problem, hoping for better luck here!
      Kind regards
      Fredrik