aspose file tools
The moose likes JSP and the fly likes Implicit session object becomes null in JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Badass: Making Users Awesome this week in the Game Development forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Implicit session object becomes null in JSP" Watch "Implicit session object becomes null in JSP" New topic

Implicit session object becomes null in JSP

mukund prem

Joined: Apr 21, 2004
Posts: 1
Hi ,
I have a jsp page which is refreshed atuomatically every 10 seconds.I get and put values in the session by using the implicit session variable .
Everything works fine for say 2-3 mins after that the implicit session becomes null suddenly and throws a null pointer exception.
I get a null pointer exception and session is printed as null but even the if block (session == null) is not executed .
I printed the value of request.getSession(false);.This gives me session object ,where as the implicit session does not have this after many refresh interval
During the first few refreshes both have the same value.
Also note that this runs fine in Windows ,I get this problem only in UNIX .
I use tomcat in unix and view using IE in windows
if (session == null){
System.out.println("session is null:::");
if (session.isNew()) {
response.setHeader("Refresh","1; URL=/MCOne/BP/index.html");
} catch (Exception e) {
System.out.println("I am in exception ");
System.out.println("I am after hello ::::"+request.getSession(false));
I have been looking into this problem for a long time now and need other ideas on the above
I have tried and confirmed all these
1.Only one browser is open so only one session,no other load on server
problem occurs in NN and IE .
2.I do not invalidate the session in any code and I use only request.getSession(false); and nothing else so guess no new session created
3.When implicit object session becomes null ,the request.getSession(false) continues to have the value dont know why only the session becomes null
4.Also implemented the session listener and found that the sessionid is same and session is not destroyed when null pointer exception occurs
Sorry for the long mail
[Bear: edited to remove shouting from subject line]
[ April 21, 2004: Message edited by: Bear Bibeault ]
I agree. Here's the link:
subject: Implicit session object becomes null in JSP