Cannot get debug mode to work with Jboss and IntelliJ

Greetings - I am creating a Java application that runs on JBoss v4.2 with IntelliJ IDEA v7.0. I am trying to get debugging working. I am running JBoss remotely (in a cmd window) and use the rundebug.bat script (snippet below) to start it up. Then I created a remote configuration with the following settings JNDI Port - 1099, Host: localhost, Host Port: 8080.

I start JBoss with the script (works fine). Then I run the debug configuration and get the following error "Error Running MAX remote: Unable to open debugger port : "Connection Refused: connect"

The relevant part of RunDebug.bat:

rem Setup JBoss specific properties

rem Add -server to the JVM options, if supported
"%JAVA%" -version 2>&1 | findstr /I hotspot > nul
if not errorlevel == 1 (set JAVA_OPTS=%JAVA_OPTS% -server)

rem JVM memory allocation pool parameters. Modify as appropriate.
set JAVA_OPTS=%JAVA_OPTS% -Xms128m -Xmx512m

rem With Sun JVMs reduce the RMI GCs to once per hour
set JAVA_OPTS=%JAVA_OPTS% -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000

rem JPDA options. Uncomment and modify as appropriate to enable remote debugging.
rem set JAVA_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n %JAVA_OPTS%
set JAVA_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,address=3871,suspend=n,server=y

I think it's this last part that is questionable. Has anyone seen this problem with JBoss and can you help me out?

Thanks - mark

1 comment
Comment actions Permalink

Got it working finally so I thought I would post the solution in case anyone else needs it...
In your batch script note the port number (address) you are using in the JAVA_OPTS statement. Then in IDEA edit your remote configuration, select the Startup/Connection tab (It's the 4th tab), click the debug list entry, and make sure the Port/Address matches, if not change it to match your script, and restart JBoss again. Should work.


Please sign in to leave a comment.