Debugging Web-application deployed on Tomcat using Eclipse

January 15, 2010

Hello,
This small article will walk you through the steps needed to setup the Eclipse environment for debugging Web application deployed on Tomcat server. I have used Tomcat 6.0.18 and Eclipse Ganymede for this purpose.

  1. Add the following lines in {tomcat.home}/bin/catalina.bat. tomcat.home is your tomcat installation directory.
  2. set JPDA_ADDRESS=1044
    set JPDA_TRANSPORT=dt_socket
  3. Open Eclipse “Debug Configurations” window. Menu Navigation – Run > Debug Configurations…
  4. Add new “Remote Java Application” as below
  5. The “Port” should match to the JPDA_ADDRESS configured above in step #1.
  6. Click “Debug” to start debugging.
  7. Start the Tomcat server using command “catalina jpda run”. This starts Tomcat in debugging mode.
  8. If the “Breakpoint” is encountered while application is being executed, Eclipse will ask you if you want to switch to Debug perspective where you can debug the application using standard debug controls.
  9. There is one nice article on IBM developer works that explains Debugging. Here is one helpful resource to know more about debugging techniques IBM RAD Tutorial .

Hope this helps in setting up a Eclipse Debugger for debugging your applications.  Do let me know if you feel this article needs improvements and your suggestions.

Cheers !

Amit

Advertisements