The following code generates an exception when getId() is called with 

Tomcat 5.5.15. In 5.5.7 it returned the session id.

 

I realize that the session is being invalidated, thus valueUnbound()
being 

called. I also realize that the servlet spec/errata says that this 

exception should be thrown when the session is invalid. I would contend 

that; at the time valueUnbound() is called the session should still be 

considered valid.

 

In our code we need to know which session is being invalidated in order
to 

do some cleanup. Any chance that Tomcat would be changed/fixed to not
mark 

the session as invalid until it has finished notifying the 

HttpSessionBindingListeners?

 

Thanks,

Blair Cooper

 

 

public void valueUnbound(HttpSessionBindingEvent event) 

{

  String sessId = event.getSession().getId();

}

 

 

java.lang.IllegalStateException: getId: Session already invalidated

      at 

org.apache.catalina.session.StandardSession.getId(StandardSession.java:3
28)

      at 

org.apache.catalina.session.StandardSessionFacade.getId(StandardSessionF
acade.java:78)

      at
com.teamon.util.system.SessionList.valueUnbound(SessionList.java:99)

      at 

org.apache.catalina.session.StandardSession.removeAttributeInternal(Stan
dardSession.java:1607)

      at 

org.apache.catalina.session.StandardSession.expire(StandardSession.java:
737)

      at 

org.apache.catalina.session.StandardSession.isValid(StandardSession.java
:577)

      at 

org.apache.catalina.session.ManagerBase.processExpires(ManagerBase.java:
678)

      at 

org.apache.catalina.session.ManagerBase.backgroundProcess(ManagerBase.ja
va:663)

      at 

org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.j
ava:1283)

      at 

org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.proc
essChildren(ContainerBase.java:1568)

      at 

org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.proc
essChildren(ContainerBase.java:1577)

      at 

org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.proc
essChildren(ContainerBase.java:1577)

      at 

org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(
ContainerBase.java:1557)

      at java.lang.Thread.run(Unknown Source)

 




---------------------------------------------------------------------
This transmission (including any attachments) may contain confidential 
information, privileged material (including material protected by the 
solicitor-client or other applicable privileges), or constitute non-public 
information. Any use of this information by anyone other than the intended 
recipient is prohibited. If you have received this transmission in error, 
please immediately reply to the sender and delete this information from your 
system. Use, dissemination, distribution, or reproduction of this transmission 
by unintended recipients is not authorized and may be unlawful.

Reply via email to