Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problems to find NullPointerExceptions in Servlets

 
Michael Ponewa�
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a problem i had several
years with servlets. We have a couple
of servlets which not use any
mvc-framework and are extended
from HttpServlet. In the processRequest
Method which is used from a Get or
Post Request we examine request values,
delegate database calls to DAOs and
collect informations for the view.
The view will be called with a
Dispatcher Forward at the end of method
processRequest.
Now the problem:
Sometimes when i have done some code
change and test i got NullPointerException
in the processRequest Method. Actual not
really a problem to find why - but the processRequest
Method is sometimes 50-100 lines and my
servlet containers log messages like this:

Servlet-Name: frontController which extends HttpServlet

servlet frontController threw exception
java.lang.NullPointerException at lv.ais.requestCover.servlets.frontController.processRequest(Unknown Source)

So why does the servlet container not log the
line where the exception occurs?


regards Michael
[ August 15, 2006: Message edited by: Bear Bibeault ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can control how much debugging info gets compiled into your classes.
Add the -g switch when compiling with javac and your classes will retain all debugging info.
 
Michael Ponewa�
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks! changed javac property with debug informations
in ant build file. Now i get the source position where
the exception occurs.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic