I use ServletContextListener to start/stop of one internal working thread. In contextInitialized(ServletContextEvent event) the Thread object will be created and started, than registred as an attribute: ServletContext context = event.getServletContext(); MailerThread mailerThread = new MailerThread(...); context.setAttribute("de.mints.interrisk.mail.thread", mailerThread) In contextDestroyed(ServletContextEvent event) the thread must be interrupted: ServletContext context = event.getServletContext(); Thread thread = (Thread)context.getAttribute("de.mints.interrisk.mail.thread"); thread.interrupt(); Under Tomcat 5.5.4 it works fine, but under 5.5.7 thread == null. It seems the context's attributes go lost.
It working under: Tomcat 5.5.4 / JDK 1.4.2_7 but not under Tomcat 5.5.7 / JDK 1.5.0_1
*** This bug has been marked as a duplicate of 33463 ***