Configuring Eclipse for Remote Debugging
Pages: 1, 2, 3, 4, 5, 6, 7, 8

Configuring a Remote Debugging Configuration in Eclipse

To remotely debug a JBoss application in Eclipse, start the JBoss server in debug mode. Set the JBoss server to debug mode by setting the debug options in the bin/run batch 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:

Parameter Description
-XDebug Enables debugging
-Xnoagent Disables previous debugging agent.
-Xrunjdwp Specifies the connection mechanism, the transport address, and server and suspend values.

For further explanation of the debug settings, refer to the JPDA documentation.

To demonstrate the remote debugging feature of Eclipse, we need to throw an exception in JBossServlet. As an example, add a NullPointerException to JBossServlet.java by replacing:

out.println("Eclipse JBoss  Debugging");

with

String str=null;

out.println(str.toString());

Next, configure a debug configuration for the Eclipse project. Select the Debug option in the Debug Option List, as shown in Figure 11.

Debug
Figure 11. Debug

This displays the Debug frame. In the Debug frame, select the Remote Java Application node. Right-click the node and select New, as shown in Figure 12.

New debug configuration
Figure 12. New debug configuration

Pages: 1, 2, 3, 4, 5, 6, 7, 8

Next Pagearrow