FCI-Helwan blog

Just another FCI-H weblog

Enabling Remote Debugging for tomcat

Sometimes your web application just works very fine on your local machine and when you move it to the deployment environment you see a BOOM. If the deployment environment is a Non-GUI machine (which is the common case), it is very hard to debug on that machine. Simply all what you need is to use a remote debugger to connect to the server machine and see what is wrong.

The concept is that you enable the web server to start the JVM in debug mode and start listening on a certain port for remote debuggers to connect, in tomcat, all what you need to do is to add this line to the catalina.sh
you will find at the begining of the file a set of lines started by “#” as they are commented, uncomment the JAVA_OPTS and insert the following line between double qoutes.
"JAVA_OPTS = -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n

-Xdebug: tells the VM to start in debugging mode.
-Xrunjdwp: selects the protocol to use,address: the port,suspend=n: tells the server to start listening even if no debugger is connected, simply, start and dont wait for a debugger to connect.

That’s it, tomcat is waiting for a debugger to connect.


November 26, 2008 - Posted by | JAVA


  1. very intersting , but
    i can`t imagine what will happen after establishing connection ?
    can i inspect variables, and know runtime values ?
    n.b) the application server don`t have source code

    Comment by Mohamed Reda | November 30, 2008 | Reply

  2. the source code is on your machine, the application server has the .Class files of The application. The application under debugging should be compiled with debugging enabled so lines numbers could be tracked. A remote debugger just asks the server for information to track the execution of the application.

    Comment by Youssef Mamdouh | December 1, 2008 | Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: