Friday, November 14, 2008

Video tutorial: Remote debugging of Java web applications in Apache Tomcat and JBoss

In this four minute tutorial I'm presenting how to remotely debug Java web applications in Apache Tomcat and JBoss containers. This tutorial may be useful if you deployed your application on the remote server and want to debug it in this particular environment. IMPORTANT: remember that your Java application HAS to be compiled with enabled debug information, otherwise you will not be able to debug it.
Remember: to start Apache Tomcat in the debug mode type this (on Windows):
set JPDA_ADDRESS=8000
set JPDA_TRANSPORT=dt_socket
catalina jpda run
on Linux you have to set environment variables using export command.
To enable remote debugging on JBoss server type this:
set JAVA_OPTS=-Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=8001,suspend=n
run <options>

More information on this subject can be found here:

Do you find this tutorial useful, interesting, fantastic or maybe boring and crappy? Please share your opinions in the comments zone.

4 comments:

Anonymous said...

Maybe you should have shown more about the prerequisites. Setting the debug flag and so on...


For example in the real world, you would probably check out a tag from svn and develop a bugfix againt this release. Would one now rebuid the tagged version and deploy it? Or is this useful only for production apps that have been compiled with the debug flag?

Przemysław Bielicki said...

I hope the video in its form is enough. If you know about any prerequisites I didn't mention in the video you are more than welcome to share them here.

How you build your project and manage test/production environments is out of the scope of this tutorial. It's up to you how you do this.

From my side I will only add one thing that sometimes can take couple of hours for you to be found. Remember that the firewall (if you have any) has to allow you to connect to the remote web container on the port you want to debug your applications.

gg said...

Thanks for post. Information about JPDA was useful for me.

Wahid Sadik said...

Thank you. It helped me.