Bonjour, I want to do some cleanup when a session dies. I tried to use HttpSessionBindingListener and then HttpSessionListener In both case, my code is called AFTER the session had been invalidated: nothing can be done with the session anymore: it seems to be useless functionality Does anyone knows how to get code called BEFORE the sesion dies? Cordialement, Nicolas Silberzahn Digital Airways Everywhere <Internet>Technologies</Internet> www.DigitalAirways.com o Google said be aware there is a ">" at the end that belongs to the URL... http://www.apachelabs.org/tomcat-dev/200202.mbox/<76227803D20F654BA920161144 [EMAIL PROTECTED]> http://www.apachelabs.org/tomcat-dev/200202.mbox/<20020220103254.B76183-1000 [EMAIL PROTECTED]> http://w6.metronet.com/~wjm/tomcat/2001/Oct/msg00252.html o Some test code: public class MySessionListener implements HttpSessionListener { public void sessionCreated(HttpSessionEvent hse) { HttpSession session = hse.getSession(); try { session.setAttribute("toto", new MyHttpSessionBindingListener());// so it will be called when the session dies... (i don't remove it explicitly elsewhere) } catch (Throwable e) { // removed error logging here } public void sessionDestroyed(HttpSessionEvent hse) { HttpSession session = hse.getSession(); ServletContext application = session.getServletContext(); // a session. getAttribute throws an exception here: Session already invalidated } } class MyHttpSessionBindingListener implements HttpSessionBindingListener { public void valueUnbound(HttpSessionBindingEvent hse) { HttpSession session = hse.getSession(); ServletContext application = session.getServletContext(); System.out.println("valueUnbound"); Object o = session.getAttribute("Caddy"); // a session. getAttribute throws an exception here: Session already invalidated // cleanup here... } public void valueBound(HttpSessionBindingEvent hse) { } } -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>