Friday, April 30, 2010

Enable Eclipse Remote Debug in JBoss

1. Open run.bat and find the lines that look like this:

rem enable remote debugging.
set JAVA_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y %JAVA_OPTS%

2. Start Jboss. (JBoss will hang there until you connect a debugger to it.)
3. In Eclipse, open your project, and on the toolbar click on the debugger bug arrow, then Open Debug Dialog.
4. Choose "Remote Java Application", right-click, New… and update the port to the address in the run.bat (address=8000, you could change it to any no).
5. Click Debug
6. Set a break point somewhere in your code or a library that has source attached
7. Exercise your project (via a web service, for instance) and when it hits one of your breakpoints, it will break in Eclipse.

No comments: