Recent Posts

RSS Feeds

Debugging Servlets In Tomcat w/ Eclipse

Well I finally got attached to Tomcat (the tomcat from jwsdp1.3)

./catalina.sh start -debug

The trick is to find the port #. I looked far and wide and could not find out which port it was actually using. I found a blog that was old that suggested it defaulted to 8000. That did not work. Finally I found launcher.xml that the commons-launcher uses. In this file the port is defaulted to 9876 under the property jpda.address. I don't see a straightforward way to set that property off hand.
In Eclipse (on a mac and other unixs) set the connection type to Standard (Socket Attach) and the Host to localhost and the port to 9876 then hit the Debug button. Assuming that catalina is up and running you should attach and be able to stop at your breakpoints. On Windows you would probably have to use shared memory instead (I don't have my windows box handy or I'd get the exact wording). The shared memory name is jdbconn.

Any ideas how to set my own value of jpda.address? Catalina uses the commons-launcher which basically uses ant files. Does it also allow a property to be set only once? If so then I could presumably put a -Djpda.address=my port # into the command line (the catalina.sh script does not appear to allow this though). 9876 is fine for now but it seems weird that there is not a way to change it (I'm sure I'm missing something...)

Your thoughts greatly appreciated.

Permalink     4 Comments



Comments:

Why don't you just use the Tomcat Plugin (http://www.sysdeo.com/eclipse/tomcatPlugin.html) for Eclipse? It makes debugging your webapp in Eclipse super-simple.

Posted by Matt Raible on January 30, 2004 at 09:23 AM MST #

Thanks Matt! I tried it out about a year ago and it didn't work very well (inconsistently started tomcat and other irritating things). I'm downloading it now and will post another blog when I get it up and running...

Posted by Bill Dudney on January 30, 2004 at 10:35 AM MST #

you can also try MyEclipse (www.myeclipseide.com) with tomcat 5.

Posted by Unknown on January 30, 2004 at 05:40 PM MST #

Try:

http://www.cis.ksu.edu/VirtualHelp/Info/J2EE1.4.beta/docs/release/ReleaseNotes.html

Posted by Craig on February 23, 2005 at 06:12 PM MST #

Post a Comment:
  • HTML Syntax: Allowed