tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Tulley" <>
Subject Re: Tomcat, eclipse and jpda
Date Fri, 05 Dec 2003 17:56:17 GMT
The source code must be on the client machine, in an eclipse project.  The binary build of
it will be in your normal web application, in a jar file in WEB-INF\lib or as a .class file
under WEB-INF\classes

You call the servlet as you normally would, by its mapping that is specified in your web.xml.
 If you can access the servlet that is running on the Tomcat server via a browser, then that
is what you do when debugging as well.

I do not understand your question about where the debug information is.  If compiled correctly,
your servlet's .class file will contain debug information.  Or, are you asking where the JPDA
settings are?  They are in,  look for the text "-Xdebug ..."  Do a google search
or search sun's site for more specific information on that.  
Or, are you asking how to attach a debugging process using Eclipse?  After you have the source
of your servle loaded in and the breakpoints set, Go to Run | Debug... then double click on
"Remote Java Application".  This should create a run configuration for your servlet code.
 Make sure you change the host field to point to your tomcat server, and the port to 8000(it
looks like that is the default address for debugging in  

Then hit apply and/or the debug button, and you should be running.  You can tell if you successfully
attached to the Tomcat process if you get switched to the debugging perspective and some threads
start getting listed in the threads window.

Then you use a browser to hit your servlet.

>>> 12/5/03 10:39:07 AM >>>
Thanks Jeff
But, I have one question... The servlet code must be in server machine or client machine?Or
two machines?  I call client machine the machine that has eclipse. And I must call servlet
in with server url? Moreover, where is the debug information? 

Jeff Tulley <> wrote:
For debugging servlets, you simply start Tomcat up on the server machine in jpda mode, make
sure you have a project in eclipse with all of your servlet code (compile with debug information,
which in my eclipse is the default), and put a breakpoint in the servlet code. Connect to
the Tomcat debug process. Then, hit the servlet with a browser, and your debugger should stop
at your breakpoint no problem.

JSPs are trickier since the source code is generated at runtime. You CAN pull in the .java
file from the tomcat work directory, put it in your project, and maybe have some luck at getting
a breakpoint set. (I do not know if it would be compiled with debug information or not though.
You could use a precompilation script to guarantee this). There might be some Eclipse plugins
that do JSP source-level debugging now, though I haven't seen one.

If you have to debug servlet init code, that is a bit trickier, though not much. Simply change, where it has the JPDA arguments, changing "suspend=n" to "suspend=y". Then the
Tomcat java process will start up and immediately suspend itself until you connect with the
debugger and resume the process.

For servlets, there is nothing too different than debugging any other plain java code.

>>> 12/5/03 8:26:12 AM >>>
I read the message in tomcat-user list about eclipse, tomcat and jpda, but i don't understand
very well. I have two machines, one is a tomcat server and the other machine is my workstation.
I execute tomcat with "./ jpda run" and i can connect with eclipse when I try to
debug. This is a client machine. But, I don't debug anything. The project to debug where would
it stay??? In server or client machine??? Moreover, how can i execute the jsp or sevlet???
With URL http://server:8080/ ????

Yahoo! Sorteos
¡Ya puedes comprar Lotería de Navidad!

Jeff Tulley (
Novell, Inc., The Leading Provider of Net Business Solutions 

To unsubscribe, e-mail: 
For additional commands, e-mail: 

Yahoo! Sorteos
¡Ya puedes comprar Lotería de Navidad!

Jeff Tulley  (
Novell, Inc., The Leading Provider of Net Business Solutions

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message