This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
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 EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Implicit session object becomes null in JSP" Watch "Implicit session object becomes null in JSP" New topic
Author

Implicit session object becomes null in JSP

mukund prem
Greenhorn

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
try{
if (session == null){
System.out.println("session is null:::");
}
System.out.println("session3:::"+session.toString());
if (session.isNew()) {
System.out.println("HI");
session.setAttribute(BPRealtimeConstants.C_JPM_SESSION_FAIL_ID,"failed")
;
response.setHeader("Refresh","1; URL=/MCOne/BP/index.html");
return;
}
} catch (Exception e) {
System.out.println("I am in exception ");
System.out.println("I am after hello ::::"+request.getSession(false));
e.printStackTrace();
}
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 ..so 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: http://aspose.com/file-tools
 
subject: Implicit session object becomes null in JSP
 
Similar Threads
Session and NullPointerException! URGENT!
What happened to the session?
request becomes null in unix
Session Timeout
Arrays