aspose file tools*
The moose likes JSP and the fly likes NullPointerException, but no root cause Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "NullPointerException, but no root cause" Watch "NullPointerException, but no root cause" New topic
Author

NullPointerException, but no root cause

Alex Kravets
Ranch Hand

Joined: Jan 24, 2001
Posts: 476
I get a NullPointerException from my jsp page but no root cause or line number, how can this be?


thanks,
Alex


All right brain, you don't like me and I don't like you, but let's just do this one thing so I can get back to killing you with beer.<br /> <br />- Homer Simpson
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Look in your logs, that's not a complete stack trace.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Alex Kravets
Ranch Hand

Joined: Jan 24, 2001
Posts: 476
but it is, I checked...
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

try wrapping your entire scriptlet in a try/catch with e.printStackTrace() in the catch block
Alex Kravets
Ranch Hand

Joined: Jan 24, 2001
Posts: 476
Ok, I found the problem. But if I leave the line that produces error which is already in try/catch block, exception is still the same though -- incomplete.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

What's in your catch block?
danny liu
Ranch Hand

Joined: Jan 22, 2004
Posts: 185
Alex,

Sometimes, the error object is not an Exception but a Throwable. If you write
your code the following way, you may catch all the errors.

try{
}
catch(Throwable err){
logger.debug(err,err);
}

Dan
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: NullPointerException, but no root cause