Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Implicit session object becomes null in JSP

 
mukund prem
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic