Simple guide to setup SSL in Tomcat

I have enabled SSL in tomcat many times however initially I struggled to get it in running condition. So I thought to share a simple approach I am following now days.

Step 1:

Run tool “Keytool“ provided by the JRE to create a “keystore file”.
The command to run tool is:

keytool -genkey -alias tomcat -keyalg RSA -keystore D:/.keyStore

Where “D:/.keystore” is the path where file should be created.
Instead of alias “tomcat” any other name can be used.
After running above command, you will be asked many questions, so answer them correctly as shown in below image:

Tomcat SSL keytool to create keystore file
Tomcat SSL keytool to create keystore file

Remember the password provided, as it will be needed in next step.

How to start the tomcat in debug mode for debugging in eclipse

1. Open the startup script in (your_tomcat_home) {Location is : %CATALINA_HOME%binstartup.bat }
2. Add the following lines at the first blank line in the file ( around line 8 )
Windows :

set JPDA_TRANSPORT=dt_socket


export JPDA_ADDRESS=8000
export JPDA_TRANSPORT=dt_socket

3. Change the execute line at the end to include “jpda”

call “%EXECUTABLE%” jpda start %CMD_LINE_ARGS%


exec “$PRGDIR”/”$EXECUTABLE” jpda start “$@”