File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes How to debug in servlet in Tomcat? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to debug in servlet in Tomcat?" Watch "How to debug in servlet in Tomcat?" New topic
Author

How to debug in servlet in Tomcat?

John McDonald
Ranch Hand

Joined: Jul 01, 2003
Posts: 112
Hi there,.
I have a null pointer exception so often from the servlet that I invoked. How do I debug it? Thanks.

John
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12803
    
    5
Logging the full stack trace would be a good start.

The most common causes of NPEs in servlets are:
1. not checking request parameters for null before trying to use them
2. not checking init parameters for null - ditto

Bill
Bruno Boehr
Greenhorn

Joined: Feb 15, 2006
Posts: 17
Depending on what IDE you are using you might be able to do debugging directly in the source code. I use Eclipse with a Tomcat plugin by Sysdeo (http://www.sysdeo.com/eclipse/tomcatplugin), and it works just great for me.


<a href="http://webjavenue.com/" target="_blank" rel="nofollow">Your first website in Java: easier than you think</a>
Pavan Tammana
Greenhorn

Joined: Mar 08, 2006
Posts: 6
Hey John,
Use Log4j which is provided by Apache. It is a good tool for logging. If you don't want logging at all, i would say you can do remote debugging. All most all the IDE's have a remote debugging feature. That's what you do for a production support project.

Thanks,
Pavan Kumar Tammana.
 
wood burning stoves
 
subject: How to debug in servlet in Tomcat?