aspose file tools*
The moose likes Tomcat and the fly likes Using SSL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Using SSL" Watch "Using SSL" New topic
Author

Using SSL

venkatesh pendharkar
Ranch Hand

Joined: Apr 29, 2006
Posts: 106
Hi
I am trying to use SSL protocol for accessing my jsp page.I have configured the following as per the tomcat docs:-
1 Create a certificate keystore by executing the following command:
Windows:
%JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA
2 Uncomment the "SSL HTTP/1.1 Connector" entry in $CATALINA_HOME/conf/server.xml and tweak as necessary
After that restart the server

I have a normal jsp page called homepage.jsp & i want to access this one using https protocol.So i want to know whether i do need to make any changes in this jsp. Because this homepage.jsp is accessible using http protocol but when i use https it gives can not find server.
Please help me in this
venkatesh pendharkar
Ranch Hand

Joined: Apr 29, 2006
Posts: 106
someone please help
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41574
    
  54
You do not need to change the JSP. Can you access https://localhost:8443/ (or are you using a different port?)


Ping & DNS - my free Android networking tools app
venkatesh pendharkar
Ranch Hand

Joined: Apr 29, 2006
Posts: 106
Thanks Ulf for the reply.
I have already tried it by using port 8443 but still it doesnt work i.e. page doesnt open.Any other suggestions?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61064
    
  66

I've moved this off to the Tomcat forum where proper setup for SSL can be discussed.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by venkatesh pendharkar:
Hi
...and tweak as necessary...


Maybe you could tell us, exactly, what tweaking you've done?
Better yet, can you post the <Connector ../> entry for your secure connector from your server.xml (minus your keystorePass value, of course)?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
venkatesh pendharkar
Ranch Hand

Joined: Apr 29, 2006
Posts: 106
this is the part of my server.xml where i have defined SSL:

<Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
port="8080"
enableLookups="true" redirectPort="8443"
acceptCount="100" connectionTimeout="20000"
useURIValidationHack="false" disableUploadTimeout="true" />
<!-- Note : To disable connection timeouts, set connectionTimeout value to 0 -->
Define a SSL Coyote HTTP/1.1 Connector on port 8443
<!-- <Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
port="8443" enableLookups="true" scheme="https" secure="true"
acceptCount="100"
useURIValidationHack="false" disableUploadTimeout="true"
clientAuth="false" sslProtocol="TLS" />-->

I just uncommented the line;-Define a SSL Coyote HTTP/1.1 Connector on port 8443 & after that i created the certificate using keytool in jdk.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

You need to tell Tomcat where your keystore is and what the password for it is:

venkatesh pendharkar
Ranch Hand

Joined: Apr 29, 2006
Posts: 106
thanks Ben for reply
Can you tell me whether keystoreFile= attribute should point to the path where keystore file is placed??Becuase i dont know where this file is stored.I searched my entire c: for *.kdb file but couldnt find anything.
So i thought of creating another certificate by keytool but now its not taking the password that I had set.it gives the error as "keytool error: java.io.IOException: Keystore was tampered with, or password was
incorrect" .I dont know why this is happening beacuase i very well remember that password that i had set was "123456".But now its not taking that password.Can you tell me if there is any way by which i can reset the password.I have reinstalled jdk as well,still it doesnt work.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

You can specify the path and filename when you run keytool.

Example:


In that example, I'm creating a keystore in the current directory with
filename: 'keystore.kdb'.
venkatesh pendharkar
Ranch Hand

Joined: Apr 29, 2006
Posts: 106
HI
I created keystore.kdb in "C:\jdk1.5.0_0\bin\" so in my server.xml i have added the following :-
keystoreFile="C:\jdk1.5.0_0\bin\keystore.kdb"
keystorePass="changeit"

Buts still it doesnt work i.e. when i try to access a jsp by https then it shows as Can not find server,but the same page is displayed when using http protocol.
Is there anything else left to be done.
I also restarted server couple of times.
smiley_siva
Greenhorn

Joined: Feb 11, 2007
Posts: 2
Hi
Me too have the same problem while setup SSL on tomcat. The port 8080(http) is working correctly, but 8443(https) shown error page. Any other Solution.
I am using Suse10.1(SLED) JDK1.4 and tomcat4.1........

Thanks in advance
siva
[ February 11, 2007: Message edited by: smiley_siva ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using SSL