Some time ago I wrote about a situation when starting of Tomcat from Netbeans failed. Of course when someone follows with steps prepared in this article, debugging is more complicated. But there is one nice feature in Tomcat – we can debug remote servers.
First thing to do is to enable debugging applications deployed on Tomcat, start Tomcat by this way:
Tomcat/bin/catalina.bat jpda start
By default, Tomcat is listening on port 8000 (changing default port is possible in some configuration files).
In second step we should connect from Netbeans to our application. Sources in IDE (in my case: Netbeans) must be identical with classes deployed on Tomcat! If there are any differences, some breakpoints will be unavailable and debugging will not working properly.
Go to Debug menu and fill forms:
Debugger: Java Debugger (JPDA)
and click OK. After a while, breakpoints should be available. Look into console. There are info about enabling each breakpoint.