Setting debug configuration for maven+jetty+eclipse

azhar_salati picture azhar_salati · Oct 24, 2011 · Viewed 31.2k times · Source

I have created a web app using maven in eclipse. I am using jetty for running the app. I am able to run the app using the maven jetty plugin. But I am facing difficulty while debugging the app - The steps that i have followed to setup debug settings are from the below link http://www.clickonchris.com/2010/05/configuring-jetty-maven-and-eclipse-together-with-hot-deploy/

I can run the app at port 8080 and it keeps on Listening for transport dt_socket at address: 4000. For debugging i have given port 4000. But when i start the debugger in eclipse it gives me a window with following error - "Failed to connect to remote VM. Connection refused. Connection refused: connect" Can some one help me out in resolving this issue for debugging the app.

Thanks!!!

Answer

Kapil Raju picture Kapil Raju · Nov 24, 2013

Set MAVEN_OPTS using -

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

Then start jetty using -

mvn jetty:run

Start remote debugging from your fav IDE on port 8000