We need to configure JBoss's bin/run.conf file. Add the following line at the end:
JAVA_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n $JAVA_OPTS"
This options mean:
- -Xdebug asks JBoss to work with debugging support
- -Xrunjdwp loads JDWP (Java Debug Wire Protocol). This option has its own options:
- transport=dt_socket means that sockets will be used for transport
- address=8787 means the address(in this case it's the local machine's port 8787) where the socket will be opened
- server=y if it is set to 'y' then it means that JBoss will listen for debugger to attach; if it is set to 'n' then it means that JBoss will attach to the debugger at the specified address
- suspend=n if it is set to 'y' then it means that JBoss will be launched in the suspended mode and will stay suspended until the debugger is connected
You may also want to check how to debug remote application with Eclipse