Topic: Servlets 2.4
Application Server: JBoss 4.0.2 / Tomcat 5.5.9
Exception:
java.lang.IllegalStateException: getCreationTime: Session already invalidated org.apache.catalina.session.StandardSession.getCreationTime(StandardSession.java:938) org.apache.catalina.session.StandardSessionFacade.getCreationTime(StandardSessionFacade.java:73) com.HelloWorldServlet2.doGet(HelloWorldServlet2.java:28) javax.servlet.http.HttpServlet.service(HttpServlet.java:697) javax.servlet.http.HttpServlet.service(HttpServlet.java:810) org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
Resolution:
Most HttpSession methods throw an IllegalStateException when the method is invoked on a HttpSession that has already been invalidated, that is, the invalidate() method has been invoked on the HttpSession object. The HttpSession object is still a valid object on the memory heap, however, not representing a legitimate client session.
This is different from the case, where the HttpSession object representing a particular client is invalidated and the object removed from the memory heap. This happens with the session times out or the HttpSession.getSession(false) returns null. In this case, a NullPointerException will be thrown on invoking a method on the HttpSession.
Remove the code that threw the exception and put it above the HttpSession.invalidate() to resolve this exception.
No comments:
Post a Comment