Wednesday, March 09, 2011

JBoss – Pause at startup until debugger is attached

A tidbit I picked up today at ATG developer training: It’s possible to configure JBoss to pause at startup until a debugger is attached. To do this, specify suspend=y in JAVA_OPTS. (This can be done in <jbossdir>\bin\run.bat.) For example, the relevant line from the run.bat I’m using in the training class:

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

With this setting, JBoss will automatically resume startup when it detects that a debugger (e.g. Eclipse) has been attached.

This is useful to be able to debug things that occur while JBoss is starting up.

No comments:

Post a Comment