Remote debug Jetty (no mvn, no plugins)

风流意气都作罢 提交于 2019-11-28 03:57:50
David Rabinowitz

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

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

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


Update:

To run from jar (standalone) do the following

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

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

In short, start your JVM with the argument:

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

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

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 -Xdebug ... doesn't works

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

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

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

  • --exec
  • -agentlib:jdwp=transport=dt_socket,address=localhost:8000,server=y,suspend=n
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!