Hi, Context destruction does not mean session destruction: that would be a violation of the servlet specification ;) The container must try to persist data for active sessions across restarts in a "robust" way (I've always had an issue for that robust word in the spec, but that's another battle).
By the time contextDestroyed is called, all session passivation has been done, hence your NPE. (This is also per the servlet spec). If you want your sessions destroyed or not persisted, consider a different configuration for your Manager element in server.xml. Yoav Shapira Millennium ChemInformatics >-----Original Message----- >From: Elie Medeiros [mailto:[EMAIL PROTECTED] >Sent: Tuesday, March 09, 2004 7:56 AM >To: [EMAIL PROTECTED] >Subject: 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: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]