Monday, December 24, 2012

Run JBoss, Tomcat/Tomee in debug mode

 

The needed params are:

-Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n

For jboss as 7 in bin/standalone.bat (or sh) add those additional params to line 53

set JAVA_OPTS=-Dprogram.name=%PROGNAME% %JAVA_OPTS%

the line will look like this:

set JAVA_OPTS=-Dprogram.name=%PROGNAME% %JAVA_OPTS% -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n

For tomcat/tomee

in catalina.bat (.sh) at this as the first line in file:

set JAVA_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n

To debug the code in Eclipse:

  1. Run -> Debug Configurations… -> Remote Java Application -> Right click –> New
  2. Then on Connect tab, set these Connection Properties: host = localhost, port=8787
  3. Then select your Project and in Source tab add extra projects or libraries.
  4. Press Apply button
  5. Press Debug button
  6. You are connected!!! – the server must be started
  7. Add a Breakpoint in your code
  8. Trigger your application to reach a Breakpoint

To debug the code in Netbeans:

  1. Go in menu: Debug->AttachDebuger…
  2. set port to 8787
  3. press ok (make sure that the server is up and running) – repeat the process every time when you need debugging

No comments:

Post a Comment