Accessing HTTPS from a Servlet

In our Project, we are using JBoss 2.2.1 and Tomcat 3.2.1. From this environment we have to access the https port of another Web Server.(iPlanet). We have successfully configured https in iPlanet and is able to access the same from an ordinary Java class. But when the same code snippet is moved to a bean/servlet in Tomcat& JBoss environment it is failing to recognise the https protocol. JSSE jar files are in the JBoss classpath.(lib\ext directory).

The error messages we are getting are ..

when the JSSE jars are in JBoss lib\ext only

java.net.MalformedURLException: unknown protocol:https

when the JSSE jars are in <jre> lib\ext also/only

java.net.SocketException: SSL implementation not

available

It will be a great help if you can help us in solving this problem. Any info/ help will be appreciated.

The code snippet related to SSL

-

***************

System.setProperty("java.protocol.handler.pkgs","com.sun.net.ssl.internal.www.protocol");

System.setProperty

("javax.net.ssl.trustStore","samplecacerts");

Security.addProvider

(new com.sun.net.ssl.internal.ssl.Provider());

//appears these properties are not getting set !!!

***********

theUrl = new URL("https://myserver:9003/");

HttpsURLConnection con = null;

con = (HttpsURLConnection)theUrl.openConnection();

con.setAllowUserInteraction(true);

con.setUseCaches(false);

con.setRequestProperty("Un_Name","Un_Value");

-

[1568 byte] By [anilkc2000] at [2007-9-26 3:25:43]
# 1
Have you tried to put the JSSE jars also in $TOMCAT_HOME/lib/ so they can be found by Tomcat? I have used Tomcat 3.2.3 with SSL (using JSSE) and it seemed to work fine. What does your environment exactly look like?Thomas
ternst0 at 2007-6-29 11:46:50 > top of Java-index,Security,Java Secure Socket Extension (JSSE)...
# 2
I solved this problem by adding the provider before setting the system property. Like this:java.security.Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol");
afloom at 2007-6-29 11:46:50 > top of Java-index,Security,Java Secure Socket Extension (JSSE)...