JBoss AS7: Using JPDA to debug the AS source code

This article will talk about how to use JPDA to debug the AS source code in both the standalone as well as the managed domain mode.   If you want to know the difference between standalone and managed domain, please look at the Core Management Concepts.

 

Standalone Mode

To start AS7 in the standalone mode with JPDA on,  you will need to change standalone.conf  (Unix or Linux)  or  standalone.conf.bat (Windows).

 

 

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

# Sample JPDA settings for shared memory debugging 
#JAVA_OPTS="$JAVA_OPTS -Xrunjdwp:transport=dt_shmem,server=y,suspend=n,address=jboss"

 

Since I use Eclipse,  I uncomment the first setting.  Please make suspend=y,  if you want to debug, because AS7 is fricking too fast to startup. You need to tame it by asking it to wait for you to attach the debugger.

 

Managed Domain Mode

 

To start AS7 in the managed domain mode with JPDA on,  you will need to change domain.conf  (Unix or Linux)  or  domain.conf.bat (Windows).

 

 

 

# Sample JPDA settings for remote socket debuging.
#PROCESS_CONTROLLER_JAVA_OPTS="$PROCESS_CONTROLLER_JAVA_OPTS -Xrunjdwp:transport=dt_socket,address=8788,server=y,suspend=n"
#HOST_CONTROLLER_JAVA_OPTS="$HOST_CONTROLLER_JAVA_OPTS -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"

# Sample JPDA settings for shared memory debugging
#PROCESS_CONTROLLER_JAVA_OPTS="$PROCESS_CONTROLLER_JAVA_OPTS -Xrunjdwp:transport=dt_shmem,server=y,suspend=n,address=jboss"
#HOST_CONTROLLER_JAVA_OPTS="$HOST_CONTROLLER_JAVA_OPTS -Xrunjdwp:transport=dt_shmem,server=y,suspend=n,address=jboss"

 

If you want to debug the domain controller, just uncomment the first setting for ProcessController.

If you want to debug the host controller, just uncomment the first setting for HostController.

 

Since the HostController starts one or more JBossAS7 servers, you may sometime be interested in debugging issues in the servers. 

 

If so, then you will need to go to domain/configuration/host.xml   and change the jvm settings for the server in question.

 

 <servers>
        <server name="server-one" group="main-server-group">
            <!-- Remote JPDA debugging for a specific server
            <jvm name="default">
              <jvm-options>
                <option value="-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"/>
              </jvm-options>
           </jvm>
           -->
        </server>

 

If you have any problems or questions, you can use the AS7 forums.