score:22

Accepted answer

if you run your war with tomcat/jetty plugin pass debug options to the maven:

export maven_opts="-xnoagent -xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000" mvn tomcat:run

if you run your war using the regular tomcat, just run it with jpda (debugger) support enabled:

$tomcat_home/bin/catalina.sh jpda start

default port for tomcat 6 jpda is 8000.

now connect with the eclipse (debug -> remote java application) to the port 8000 and enjoy your fine debugging session.

score:3

is there some kind of launch configuration i should create, or do i attach the debugger remotely? is there something in eclipse that can help...like a plugin?

with m2eclipse (and the maven integration for wtp that you install from the extras), you could use the wtp and start your app in debug mode.

as an alternative, you could connect a remote debugger to a jetty. see debugging with the maven jetty plugin in eclipse.

score:3

a better way of adding the debugging options to $maven_opts option, and thus not merging them with the other existing options (if you want to start your app not in the debug mode, you have to remove those options again), is to use the maven out of the box debugger mvndebug, located in its bin directory, this way mvndebug jetty:run. this will execute your app in debug mode and what's remaining is attaching your debugger.

score:4

to enable debugging through eclipse :

i pass following to tomcat startup:

-xnoagent -xrunjdwp:transport=dt_socket,server=y,address=9999,suspend=n

then through eclipse do remote debug.

  • goto debug menu > debug configuration

  • scroll down to select remote java application

  • rt click to create new
    configuration
  • select connection type as standard (socket attach) and add hostname and port.

to start debugging simple open it when server is running.---


Related Query

More Query from same tag