Configuring Remote Debugging in Jboss AS 7 and Eclipse

Configure JBoss

First, to enable JBoss to allow remote debugging, edit your <jboss install location>/bin/standalone.conf.    Now, look for # JAVA_OPTS="$JAVA_OPTS -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n" and uncomment it.  It should be near the bottom.

If you are on Windows, you’ll need to edit standalone.conf.bat instead and uncomment rem set "JAVA_OPTS=%JAVA_OPTS% -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"

Start Jboss. You should now see something like this at the top of the output

Configure Eclipse

Configuring Eclipse is easy. First start by creating a new debug configuration by going to Run > Debug Configurations…  In the left side panel, select Remote Java Application, then in the toolbar up top, click on the new icon.  This will give you a new debug configuration.  On the right side, name it however you like.  Then, change the port to 8787 and the host to where ever your JBoss installation is running.  I’m running mine on the same machine that I am debugging on, so I leave it as localhost.  Hit the Debug button.

Lastly, you’ll need to switch to the debug view to see all of your tools. To do so, go to Window > Show View > Other…, type in  “debug” in the filter box and select the debug view.  You should now see a JVM with a list of a bunch threads.  If you don’t see any threads, make sure that JBoss is running and that you followed the steps above correctly.

If all went well, you can now set break points in your code and they should show up automatically in the debugger.