File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "null pointer exception after session expire" Watch "null pointer exception after session expire" New topic
Author

null pointer exception after session expire

Sunil Chavan
Greenhorn

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);
}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

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: http://aspose.com/file-tools
 
subject: null pointer exception after session expire
 
Similar Threads
Trouble with a toy tree [SOLVED]
Problem with jsf tree
JSF tree component NULL pointer exception
session variable
How would I...