debug your webapp – the simple way

Ben Gurion-University Beersheva (Israel), by Christoph Burmeister (own photo)

Ben Gurion-University Beersheva (Israel), by Christoph Burmeister (own photo)

Debugging your webapp is not as hard as it could be without Tomcat 😉 Just take a normal Tomcat-Installation (download, unzip, configure) and put your packaged war-file into the webapps-directory. If it works, fine. If not, search the bug. Of course, you could do the debugging in your eclipse, maybe with an integrated tomcat or app-server-plugin, but sometimes the deployment-process takes a while and if there are to much things unknown, you would likely deploy the war-file to another machine and let the tests begin. Then you can connect remotely and debug while real data is flowing through your application.
When using Windows OS just create a debug.bat-file with the following content:

set JPDA_TRANSPORT=dt_socket
call catalina.bat jpda start

and put this batch-file into the bin-directory, so it can reach the catalina.bat. Execute the batch and see how your webapp is starting. Go into the ide of your choice and configure a remote debugging. In my case it is eclipse and you have to go to „Debug-Configurations“ >> „Remote Java Application“ >> „Create new“

Then fill the little form with all required information and connect to the remote jvm. The jdpa will allow you to stop the processing of the remote app at your breakpoints in your eclipse-project.

Thanks to the stackoverflow-guys.