Lets create and simple Web Application with Single Servlet.
Once the Web Application is ready, lets export .war file to Tomcat 7.0.22.
Now let’s verify whether debug property is set or not in catalina.bat file;
it is available at apache-tomcat-7.0.22bin; By default settings are done for debugging in Tomcat 7.0.22. If it is not done or modified then do the following changes.
Open the Servlet source file of the web application in Eclipse and set the BREAK point.
Select Debug Configurations
Now. Change the Debug Configurations.
Open command prompt -> Go to the path of Tomcat distribution Directory/bin
catalina jpda start
Click on Debug on Eclipse
Open the Browser and enter the URL (in our case it is http://localhost:8080/JavaWebProject/HelloWorldExample)
The moment you press enter, you will see debug mode indicator in taskbar,
Now the flow will be paused on the breakpoint we created earlier.
Now you can use Step Into (f5), Step Over (f6), Step Return (f7) to debug as per the application code and your requirement to debug, for simplicity we have only one statement for debugging.
Now in browser you will be able to see the output.
Other Interesting Tomcat related Articles:
- How to Create and Run Web Project (Java) in Eclipse (clean-clouds.com)
- How to Solve Servlet Errors in Eclipse? (clean-clouds.com)
- How to add Tomcat 7.x in Eclipse? (clean-clouds.com)
- How to Export WAR file from Eclipse to Tomcat (clean-clouds.com)
- How to debug Web Application remotely with Eclipse Indigo and Tomcat 7.0.22? (clean-clouds.com)
- Tomcat Server running as Windows service (clean-clouds.com)
- How to customize the location of the tomcat logging.properties file? (clean-clouds.com)
- Install Tomcat 7 or Tomcat 7.0.26 or Tomcat 6 or Tomcat 5 on Ubuntu 11.10 or Ubuntu 11.04 or Ubuntu 10.10 or Ubuntu 10.04 LTS (clean-clouds.com)