Tuesday, August 22, 2006

Remote debugging with Eclipse and Tomcat on Windows

Having worked in Java mostly from GVIM, I felt very uneasy with the words like Remote Debugging in Eclipse integrated with Tomcat Running In Debug Mode, until I tried it out.
The procedure really is very very simple, and following writeup might help someone in similar situation.

  • Deploy your war file in Tomcat

  • Test the deployed application works in non-debug mode using web browser

  • Start Tomcat in debug mode by following steps mentioned below

    • Set the following paramters in environment

    • C:\Apps\Apache\Jakarta\Tomcat\bin>env | grep -i jpda
    • Start Tomcat as C:\Apps\Apache\Jakarta\Tomcat\bin>catalina.bat jpda start

  • In debug dialog create new 'Remote Java Application'.
  • Set host to where Tomcat is running and port to JPDA_ADDRESS
  • Set breakpoint whereever you need to and take action to execute that code path.
  • That's all there is to it.

Problems encountered:
For some reason, JPDA_ADDRESS value was ignored in startup, you can cross check that by the logging @startup of Tomcat

No comments: