tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Guyatt" <pguy...@telesoft-technologies.com>
Subject RE: SESSION VARIABLE BECOMES NULL AFTER SOME REFRESH
Date Mon, 12 Apr 2004 10:39:32 GMT
Hi There,

	The NPE is coming from the { if (session == null || session.isNew()) }
since even if session is null then you are still trying to call a method of
session.

a safer alternative would be

if (session == null) {
	//error
} else {
	if (session.isNew()) {

	} else {

	}
}

Thanks

Pete

-----Original Message-----
From: MUKUND Premchander [mailto:PMukund@covansys.com]
Sent: 12 April 2004 11:19
To: tomcat-user@jakarta.apache.org
Subject: SESSION VARIABLE BECOMES NULL AFTER SOME REFRESH


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 session becomes
null and throws a null pointer exception.

IN the try block I even have a code as
try {
     if (session == null || session.isNew()) {
            //do something
      } else {
             //do otherwise
      }
 }catch(Exception e )
 { //print stack trace and value of session }

I get a null pointer exception and session is preinted as null but even
the if block is noit 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 refresh both have the same value.

Also note that this runs fine in Windows ,I get this problem only in
UNIX . I use tomcat 3.2 in unix and view using IE in windows

Please help me out as to where I am going wrong .

thanks and Regards
Mukund




---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message