|
Problem(Abstract) |
The exception, java.lang.IllegalStateException, is thrown
by the Session Manager if the session object is invalid. |
|
|
|
Cause |
The following methods will all throw the
IllegalStateException if the session object is invalid:
- SessionData.putValue
- SessionData.getValue
- SessionData.removeValue
- SessionData.isNew
- SessionData.getMaxInactiveInterval
The following is an IllegalStateException:
[02.11.15 04:05:54:500 PST]
3ced77c6 ServletInstan X Uncaught service() exception root cause {0}: {1}
"LoginServlet"
java.lang.IllegalStateException:
Session Object Internals:
id : QJP45EI1FEA0XAOKNVSDENA
hashCode : 1681586149
create time : Fri Nov 15 04:04:03 PST 2002
last access : Fri Nov 15 04:05:26 PST 2002
max inactive interval : 3600
user name : anonymous
valid session : false
new session : false
session active : false
overflowed : false
session application parameters :
enable epm : true
non-serializable app specific session data:
{loginData=com.bb.toys.bobject.Data@9bf4f7e6}
serializable app specific session data : {previousPage=login}
session data list : Session Data List -> id : MRU next : null
prev : null
at com.ibm.servlet.personalization.sessiontracking.SessionData.putValue
at
com.ibm.servlet.personalization.sessiontracking.SessionData.setAttribute
at com.bb.toys.servlet.LoginServlet.doPost(LoginServlet.java
at javax.servlet.http.HttpServlet.service |
|
|
|
Resolving the
problem |
There are two reasons this exception occurs:
- The application invalidates the session and then tries to access it on
the same request.
- Two threads within the JVM™ both gain access to the session object.
One thread invalidates the session and then the other thread attempts to
use the session object
The following steps occur within the same request:
- HttpSession mySession = request.getSession();
- The mySession.invalidate() method is called.
- One of the following methods is called on the session object:
- mySession.putValue(myString, "is the session invalid");
- mySession.getValue(myString);
- mySession.removeValue(myString);
- mySession.isNew();
- Any other attempted operation on the session object.
Check the servlet or JavaServer™ Pages (JSP™) that threw the exception to
determine if the scenario described above applies to your situation. If
not, continue to the next section.
Two threads within the JVM both gain access to the session object. One
thread invalidates the session and then the other thread attempts to use
the session object.
1. Application code in Thread-1 gains access to the session object by
calling:
HttpSession mySession =
request.getSession(); |
|
2. Application code in Thread-1 gains access to the session object by
calling:
HttpSession mySession =
request.getSession(); |
|
3. Application code in Thread-2 gains access to the same session object by
calling:
HttpSession mySession =
request.getSession(); |
|
4. Thread-2 invalidates the session object.
5. Thread-1 attempts to use the session object by calling one of the
following methods:
mySession.putValue(myString, "is the session
invalid");
mySession.getValue(myString);
mySession.removeValue(myString);
mySession.isNew();
- Any other attempted operation on the session object.
|
|
|
|
|
Cross Reference information |
Segment |
Product |
Component |
Platform |
Version |
Edition |
Application Servers |
Runtimes for Java Technology |
Java SDK |
|
|
|
|
|
|