IntelliJ, JBoss

JBoss Remote Debugging Using IntelliJ

1. Stop the JBoss server if it’s running already.

2. Un-comment following line in JBoss/bin/run.conf.bat file
set “JAVA_OPTS=%JAVA_OPTS% -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n”

3. Start the JBoss server using the command prompt by following these steps:
a. Open a command prompt in JBoss/bin directory
b. Type in ‘run.bat’ and hit Enter
c. This will start the JBoss server. The command prompt will need to stay open for the remainder of the session.

4. Add a new ‘Remote’ debug configuration in IntelliJ by following these steps:
a. Click on ‘Edit Configurations’ in IntelliJ
b. Click on green ‘+’ icon to add a new configuration
c. From the list, select ‘Remote’
d. Specify a name to your new configuration (Example: JBoss)
e. Specify the port number from your ‘JBoss/bin/run.conf.bat’ file. It’s 8787 by default
f. Leave all other fields as defaults.
g. Hit ‘Apply’ and then ‘Ok’
h. You will notice a new configuration with the name you provided in the drop down in IntelliJ
i. Click on green ‘Debug JBoss’ icon next to the drop down
j. You will notice a message saying “Connected to the target VM, address: ‘localhost:8787’, transport: ‘socket'” in the IntelliJ console

5. You can now debug as usual, set break points, and inspect variables.