You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Elie Medeiros <nc...@networkphotographers.com> on 2004/03/09 13:55:40 UTC

sessionDestroyed in SessionListener does not get called on Context destruction

Hi there,

I have some tidying up to do on session destruction, which doesn't take
place when the context gets destroyed.

I am having a problem with my HttpSessionListener. It works fine when
the session is invalidated within tomcat by session.invalidate() (eg
when a user logs off), but the sessionDestroyed method does not seem to
get called when the context gets destroyed.

I have tried adding a "session register" with a list of all live
sessions, held as a context attribute using context.setAttribute(String,
Object). This gets called in the contextDestroyed method of the
ServletContextListener, and tried to invalidate each existing session
manually. This doesn't work however - it throws a NullPointerException
on the session object, presumably because the session doesn't exist
anymore at that point.

Any suggestions on how to get around this? I am using Tomcat 4.1.18 on
Win2k.

thanks,
Elie

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org