tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hari" <ha...@kumaran.com>
Subject Accessing Secured Site from within Tomcat.
Date Tue, 07 Jan 2003 09:11:05 GMT
Hi Everyone!

Greetings!

I have a problems with Tomcat (4.0.4) while accessing a secured site from
inside a JSP or Servlet.  Please find the code (JSP) below.  However, when I
execute the code as a standalone Java Program, I get the expected result.
But inside Tomcat, I get "unknown protocol: https" error.

1. I put the three jar files in common/lib folder of Tocmat.
2. I added the security provider. (com.sun.net.ssl.internal.ssl.Provider)
3. Set the required System properties.

I expect you'll help me to get out this problem.

Thanks and Regards,

Hari.

PS: Kindly CC me (harir@kumaran.com) in your replies as I'm not the
subscriber to either list.


Here is the Stack Trace:
*----------------------*
java.net.MalformedURLException: unknown protocol: https
	at java.net.URL.(URL.java:480)
	at java.net.URL.(URL.java:376)
	at java.net.URL.(URL.java:330)
	at org.apache.jsp.https$jsp._jspService(https$jsp.java:69)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
<snip>..


Here is the (simple) JSP code I use:
*----------------------------------*
<%@ page language="java"
import="java.lang.*,java.net.*,java.util.*,HTTPClient.*" %>
<%
      System.getProperties().put( "java.protocol.handler.pkgs",
					"com.sun.net.ssl.internal.www.protocol");
      System.getProperties().put( "javax.net.debug",
					"all");
	System.getProperties().put( "javax.net.ssl.trustStore",
					"d:\\work\\ssl\\cacert.dat");
	System.getProperties().put( "javax.net.ssl.trustStorePassword",
					"changeit");
      java.security.Security.addProvider(
			new com.sun.net.ssl.internal.ssl.Provider());

	URL url = new URL( "https://prasanna/getProperties");
	HTTPConnection con = new HTTPConnection( url);
	HTTPResponse   rsp = con.Get( "/getProperties");
	System.err.println( "Received Code: " + rsp.getStatusCode());
	System.err.println( "Received Message: "+rsp.getReasonLine());
      String data = rsp.getText();
      System.err.println( data);
%>
<%= data %>


--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message