It is hard to debug an application outside of an IDE. Setting up a Remote Debugging Configuration in Eclipse is really easy so that you can debug your application from within Eclipse.
First set the JBoss server to debug mode by setting the debug options in the bin/run batch/startup script file.
The debugging provided by JBoss is based on the Java Platform Debugger Architecture (JPDA). Set the JAVA_OPTS variable as follows:
set JAVA_OPTS= -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=8787, server=y,suspend=n %JAVA_OPTS%
The different debug parameters are:
- -XDebug - Enables debugging
- -Xnoagent - Disables previous debugging agent.
- -Xrunjdwp - Specifies the connection mechanism, the transport address, and server and suspend values.
Now simply start the JBoss server.
Second step is to create a Debug Configuration in Eclipse. Open Eclipse, go to Run->Debug Configurations... and select Remote Java Application. Now click on New Launch Configuration.
Provide a name for the configuration, then select the project, leave the Connection Type and Host(provide the hostname if the JBoss server is running on a different machine) and the Port you provided above, in this example enter 8787.
That's it, now your remote debugging setup is ready! Click on the Debug button to start debugging your application running on JBoss.Happy debugging!