[ACCEPTED]-Remote debug Jetty (no mvn, no plugins)-remote-debugging

Accepted answer
Score: 38

This is what we are adding to our JBoss 4 command line while development:

-Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n

Then we launch 3 the eclipse remote debugging and connection 2 to this port.


Update:

To run from jar (standalone) do 1 the following

java -Xdebug -Xrunjdwp:transport=dt_socket,address=8585,server=y,suspend=n -jar start.jar 
Score: 18

For remote debugging you should use JPDA. There's 5 a sort of tutorialish article about it available 4 here.

In short, start your JVM with the argument:

-agentlib:jdwp=transport=dt_socket,server=y,address=8000,suspend=n

and 3 you are able to connect to the underlying 2 JVM listening on port 8000 via the standard 1 Eclipse debugger.

Score: 15

If you will use mvn jetty:run one day, you have to

export MAVEN_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=n"

appending 1 -Xdebug ... doesn't works

Score: 0

Using the JVM "agentlib" command-line parameter 6 before "start.jar" did not work for me, but 5 this does:

How to allow Eclipse to remotely 4 debug #Jetty (#JPDA #agentlib:jdwp) on port 3 8000

You have to create a file, $JETTY_BASE/start.ini (do not 2 change $JETTY_HOME/start.ini) and put the following two lines 1 in it:

  • --exec
  • -agentlib:jdwp=transport=dt_socket,address=localhost:8000,server=y,suspend=n

More Related questions