How To Remote Debug JBoss from Eclipse
These instructions describe how to remote debug a JBoss application server from within the Eclipse Development Environment.
Prerequisites
- JBoss
- Eclipse
- You must have the source of the code you wish to debug imported into Eclipse. (Ensure that the version of the source code is the same as the version of the runtime code)
- The code being debugged must have been compiled with line numbers and debug symbols enabled
- If you are debugging a remote server accessed via ssh, you need to create a tunnel on the port you have chosen (e.g. 8787).
On the JBoss side of things
You must enable Java JDWP debugging in JBoss. JDWP is enabled in any Java VM by adding a specific runtime option (-Xrunjdwp). This runtime option includes the transport to use and the details of that transport.
...
Go ahead and start JBoss now. Depending on the state of the "suspend" option, JBoss will either start up normally or it will appear to be frozen (but actually waiting for your debugger to connect).
On the Eclipse side of things
- Create a new Debug Configuration of type Remote Java Application
- Go to Run->Debug Configurations
- Right-click on Remote Java Application in the left panel
- Click New
- Fill out the info - give the configuration a name, select the Eclipse project that contains the source code you are debugging, set your connection properties (these should correspond to the settings in your JBoss run.bat)
- Click Apply - do not click Close (keep the Debug Configurations dialog open)
- Make sure your new Debug Configuration is selected, then click the Debug button
- Eclipse will attach to JBoss
- If you set the "suspend" option to "y" then JBoss will now start up
- Set breakpoints, point your browser at your web app, step through your code
For remote debugging Tomcat
The catalina script (sh or bat) supports JPDA natively. See nice instructions in Sakai wiki for how to set up. The eclipse side is the same.