Remote Debugging: Tomcat 5 + Eclipse

I can’t remember how many times I’ve had to set this up, but I always end up wasting time googling an answer, which is mostly good, but sometimes misses the mark (Jon Eaves’ remote debugging solution is closest to the mark, but his is a Windows solution.) For the record, here is how I just did it in OS X:

  1. Make sure normal Tomcat environment variables (CATALINA_HOME, JAVA_HOME etc) are set.
  2. At the command line:

    $ export JAVA_OPTS= "-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"
    $ startup.sh
  3. Note: I didn’t have to include “jdpa start” arguments
  4. Go to Eclipse, then Run->Debug…
  5. Then create new “Remote Java Application”, rename it and run (the defaults should be fine)

For the record, it’d probably be better to run Tomcat directly from Eclipse, but I don’t have time to set that up right now — so tried and tested it is.

No Comments

Leave a reply