Wednesday, February 14, 2007

Remote debugging in JBoss

I recently had the need to fire up remote debugging in JBoss. I'm using Eclipse, but I'm sure the directions are fairly similar for any remote debug-capable IDE. Pretty much you can follow the directions here, with one change (for windows) and one suggestion:

Change: The directions suggest that for windows, you need to use the shared memory transport flag: transport=dt_shmem. However, that didn't work for me. But the original socket flat, recommended for nix, did work.

Suggestion: Rather than copy the run file and put in these parameters, it's pretty easy to set them in the environment and then just call run (and avoids copied code). Here's mine:

set JAVA_OPTS=-Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=4142,suspend=n
call run.bat

Note that you don't need double quotes around the env var, despite any spaces. However, you cannot have any spaces between JAVA_OPTS, the =, and the var definition.

Happy debugging!