Tag Archives: debug mode

How to run apache tomcat in debug mode (Ubuntu)?

In my previous blog post I have shown you how to install apache tomcat in Ubuntu. We can run apache tomcat in debug mode and debug our applications. First you should download and installed tomcat in your machine.

There are two ways to run apache tomcat in debug mode

I) Using jpda run

First you have to set jpda environmental variables. Please remember set this variable only one time. Don’t set this variable every time you are going to start the server. It will cause to an error.

export JPDA_ADDRESS=8000

export JPDA_TRANSPORT=dt_socket

Then run the tomcat server in debug mode using following command.

%TOMCAT_HOME%/bin/catalina.sh jpda start

or going to the bin of your tomcat folder in the terminal and run the following command

sudo catalina.sh jpda start

II)Using JAVA_OPTS

Same as the previous method you have to set one environmental variable . First go to the bin directory on your tomcat folder and run the following command. Don’t set this variable again and gain, only one time is enough.

export JAVA_OPTS=-Xdebug Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8080

 

Then you can run the server in debug mode using following command.

execute this command in the bin folder of the tomcat.

sudo sh catalina.sh  run

if you get the following output, you will run the server debug mode successfully.

debug