Setting debug configuration for maven+jetty+eclipse
Asked Answered
I

4

17

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!!!

Inseminate answered 24/10, 2011 at 11:36 Comment(1)
Issue resolved....all the steps given in the above mentioned links are working well...i faced issues because after starting the debugger i got the error message as port 4000 was already in use...Inseminate
S
42

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

Sevastopol answered 24/11, 2013 at 4:31 Comment(2)
should be mvn jetty:runKatlaps
or simply mvnDebug jetty:runEncapsulate
C
8

Here's a quick workaround. I was battling with this problem also and after a while I achieved a lazy solution.

I use Eclipse Indigo with m2eclipse. I created a new Run Configuration: Right-Clicked the project in Project Explorer -> Run As... -> maven build. Then I defined the necessary maven commands/goals to run the project with jetty straight from Eclipse.

Finally I just ran the newly created configuration in Debug mode and got debug working. This probably messes up something else(?) but works as a quick workaround.

Chapbook answered 25/10, 2011 at 20:7 Comment(2)
Whoops sorry, I realized just now it was already resolved. I should buy new glasses.Chapbook
hey its ok...got chance to know about your work around thanks!Inseminate
B
5

As suggested by h3xstream in one of the comments, you can run using mvnDebug jetty:run.

Bowers answered 19/6, 2018 at 15:47 Comment(0)
H
1

As mentioned by Pascal Thivent in this answer, since Maven 2.0.8 one can use mvnDebug in the following way:

mvnDebug jetty:run

This will start maven in debugger mode on port 8000.

Hotbox answered 30/1, 2020 at 10:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.