Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

null pointer exception after session expire

 
Sunil Chavan
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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);
}else{
//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
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic