tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jon Wingfield <jon.wingfi...@mkodo.com>
Subject Re: HttpSessionListener in Tomcat 4.1.27 (or HttpSessionListener in general)
Date Wed, 26 Nov 2003 19:58:34 GMT
Lukas,

Check the difference in the javadoc for HttpSessionListener between 
servlet specs 2.3 (J2EE 1.3) and 2.4 (J2EE 1.4). In 2.4 containers the 
session should (as I read it) still be valid in sessionDestroyed(...).

Jon

J2EE 1.3: http://java.sun.com/j2ee/sdk_1.3/techdocs/api/index.html
J2EE 1.4: http://java.sun.com/j2ee/1.4/docs/api/index.html

Shapira, Yoav wrote:

> Howdy,
> By the time sessionDestroyed is call, the session has been invalidated.
> That doesn't mean you can't get information about it: only certain
> information ;)  HttpSession#getAttribute is clearly documented to throw
> an IllegalStateException if called on an invalidated session.
> 
> If you're interested in attributes, implement an HttpSessionAttribute or
> Binding listener.  In it, you will be notified when an attribute is
> removed and you will be able to access its value.
> 
> Yoav Shapira
> Millennium ChemInformatics
> 
> 
> 
>>-----Original Message-----
>>From: Lukas Bradley [mailto:lukas@somnia.com]
>>Sent: Wednesday, November 26, 2003 1:07 PM
>>To: tomcat-user@jakarta.apache.org
>>Subject: HttpSessionListener in Tomcat 4.1.27 (or HttpSessionListener
> 
> in
> 
>>general)
>>
>>All,
>>
>>When I attempt to access the HttpSession object within the
>>sessionDestroyed(), I get the following error.
>>
>>DEBUG [StandardManager[]] (SessionListener.java:40) -
> 
> sessionDestroyed()
> 
>>StandardManager[] Session event listener threw exception
>>java.lang.IllegalStateException: getAttribute: Session already
> 
> invalidated
> 
>>       at
>>org.apache.catalina.session.StandardSession.getAttribute(StandardSessio
> 
> n.ja
> 
>>v
>>a:954)
>>       at
>>org.apache.catalina.session.StandardSessionFacade.getAttribute(Standard
> 
> Sess
> 
>>i
>>onFacade.java:171)
>>       at
>>dollars.ui.actions.DollarsAction.getUserVO(DollarsAction.java:46)
>>       at
>>dollars.ui.controllers.SessionListener.sessionDestroyed(SessionListener
> 
> .jav
> 
>>a
>>:42)
>>       at
>>org.apache.catalina.session.StandardSession.expire(StandardSession.java
> 
> :659
> 
>>)
>>       at
>>org.apache.catalina.session.StandardSession.expire(StandardSession.java
> 
> :608
> 
>>)
>>       at
>>org.apache.catalina.session.StandardManager.processExpires(StandardMana
> 
> ger.
> 
>>j
>>ava:793)
>>       at
>>org.apache.catalina.session.StandardManager.run(StandardManager.java:87
> 
> 0)
> 
>>       at java.lang.Thread.run(Thread.java:536)
>>
>>Why would the HttpSessionEvent *seem* like it should have access to the
>>session that has just been removed, yet not be able to access it?  Is
> 
> this
> 
>>a
>>Tomcat problem, or does the Servlet 2.3 spec simply want you to know
> 
> that
> 
>>some random session was just invalidated, but you can't get any
> 
> information
> 
>>about it.
>>
>>Any help appreciated.
>>
>>Lukas
>>
>>
>>
>>




---------------------------------------------------------------------
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