Troubleshooting
Problem
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} |
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(); |
HttpSession mySession = request.getSession(); |
HttpSession mySession = request.getSession(); |
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.
[{"Product":{"code":"SSEQTP","label":"WebSphere Application Server"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Java Message Service (JMS)","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"8.5;8.0;7.0;6.1;6.0","Edition":"Advanced;Base;Network Deployment;Single Server","Line of Business":{"code":"LOB45","label":"Automation"}},{"Product":{"code":"SSNVBF","label":"Runtimes for Java Technology"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"Java SDK","Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"LOB36","label":"IBM Automation"}}]
Was this topic helpful?
Document Information
Modified date:
15 June 2018
UID
swg21082806