How to debug Web Application remotely with Eclipse Indigo and Tomcat 7.0.22?


Lets create and simple Web Application with Single Servlet.

Java – Download Free EBooks and Whitepapers

Visit How to Create and Run Web Project (Java) in Eclipse

Once the Web Application is ready, lets export .war file to Tomcat 7.0.22.

Visit How to Export WAR file from Eclipse to Tomcat

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.

catalina.bat in Tomcat
catalina.bat in Tomcat

Open the Servlet source file of the web application in Eclipse and set the BREAK point.

Breakpoint in Eclipse to debug web application remotely
Breakpoint in Eclipse to debug web application remotely

Select Debug Configurations

Now. Change the Debug Configurations.

Debug Configuration in Eclipse
Debug Configuration in Eclipse

Open command prompt -> Go to the path of Tomcat distribution Directory/bin

catalina jpda start

Start Tomcat in Debug Mode
Start Tomcat in Debug Mode

Click on Debug on Eclipse

Debug in Eclipse
Debug in Eclipse

Open the Browser and enter the URL (in our case it is http://localhost:8080/JavaWebProject/HelloWorldExample)

Run Web Application Firefox
Run Web Application Firefox

The moment you press enter, you will see debug mode indicator in taskbar,

Debug Mode
Debug Mode

Now the flow will be paused on the breakpoint we created earlier.

Remote debugging of an Application in Eclipse
Remote debugging of an Application in Eclipse

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.

Debug Buttons in Eclipse
Debug Buttons in Eclipse

Now in browser you will be able to see the output.

Servlet Output
Servlet Output

Other Interesting Tomcat related Articles:

Advertisements

16 thoughts on “How to debug Web Application remotely with Eclipse Indigo and Tomcat 7.0.22?”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s