Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes JSP and the fly likes null pointer exception after session expire Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "null pointer exception after session expire" Watch "null pointer exception after session expire" New topic

null pointer exception after session expire

Sunil Chavan

Joined: Apr 11, 2007
Posts: 28
In my jsp i m using tree tag by jenkov. But after session expired if i click on any tree node it gives null pointer exception.

To tackle it i put my code in if...else... condition as follows.

if(null == session) {
// session is null so redirect it to the home page.
response.sendRedirect(request.getContextPath() + CommonConstants.REDIRECT_URL);
//tree tag code here..

Below if...else i dont have any code except few end tags of html (like </body> & </html>

But even though taking care of everything it still gives me null pointer exception if i click on any node after session expire.

What could be the reason behind this and how can i resolve it.
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

As with any NullPointerException, the first thing to find when trying to solve the problem is the variable that is null.

Have you gone through the logs to see if there is a stack trace in there?
If so, find out what line of code is throwing the exception and find out what variable on that line is null.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
I agree. Here's the link:
subject: null pointer exception after session expire
jQuery in Action, 3rd edition