Category Archives: JBoss

Remote Debug on JBoss AS 7

Enabling remote debugging on JBoss AS 7 is pretty easy – instead of changing the /JBOSS-HOME/bin/run.conf file (as it was the case with JBoss 5) you will change the /JBOSS-HOME/bin/standalone.conf file. It makes a lot of sense, since you no longer have run.sh, but standalone.sh.

Anyway, open the standalone.conf file and look for the following lines (you should shut JBoss down prior to doing this):

# Sample JPDA settings for remote socket debugging
#JAVA_OPTS="$JAVA_OPTS -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"

Then, just remove the ‘#‘ char prior to JAVA_OPTS, so that it would look like:

# Sample JPDA settings for remote socket debugging
JAVA_OPTS="$JAVA_OPTS -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"

That’s it. Save the file and start JBoss normally. It will be accepting remote debug connections on port 8787.

UPDATE:

If you’re running JBoss AS 7 on Windows, you should look for the file JBOSS-HOME\bin\standalone.conf.bat and then look for the section:

rem # Sample JPDA settings for remote socket debugging
rem set "JAVA_OPTS=%JAVA_OPTS% -agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n"

You should then remove the “rem” word from the second line (“rem” marks a comment for .bat files – same as “#” in Linux), so the section would look like this:

rem # Sample JPDA settings for remote socket debugging
set "JAVA_OPTS=%JAVA_OPTS% -agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n"

Save your file and start JBoss again.

When it starts you should see the JAVA_OPTS are set:

===============================================================================

JBoss Bootstrap Environment (...)

JBOSS_HOME: "..."

JAVA: "C:\Program Files\Java\jdk1.7.0\bin\java"

JAVA_OPTS: "-verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=3M 
-XX:-TraceClassUnloading -XX:+UseCompressedOops -Dprogram.name=standalone.bat -Xms1G -Xmx1G -XX:MaxPermSize=256M -Djava.net.preferIPv4Stack=true -Djboss.modules.policy-permissions=true -Djboss.modules.system.pkgs=org.jboss.byteman
-agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n" ===============================================================================

 

Share Button