In Tomcat 5.5.7, the context attributes seem to have been removed before the method destroy() of the loaded servlets is called. This is not the case with Tomcat 5.0.28 and I guess that it is wrong because Struts for instance relies on it to destroy its modules (in org.apache.struts.action.ActionServlet#destroyModules). In the case of struts, this causes the plugins not to be notified that they are destroyed what is against their expected behavior. A simple servlet illustrates the problem: public class TestServlet extends HttpServlet { public void init() throws ServletException { log("In init TestServlet"); getServletContext().setAttribute("test", "test"); log("Attribute test: " + getServletContext().getAttribute("test")); } public void destroy() { log("In destroy TestServlet"); log("Attribute test: " + getServletContext().getAttribute("test")); super.destroy(); } } Configured with: <servlet> <servlet-name>test</servlet-name> <description>Custom test</description> <servlet-class>de.internetzky.test.TestServlet</servlet-class> <load-on-startup>2</load-on-startup> </servlet> <servlet-mapping> <servlet-name>test</servlet-name> <url-pattern>/foo/*</url-pattern> </servlet-mapping> Gives following output in Tomcat 5.5.7: INFO main org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/test] - test: In init TestServlet INFO main org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/test] - test: Attribute test: test INFO http-8080-Processor24 org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/test] - test: In destroy TestServlet INFO http-8080-Processor24 org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/test] - test: Attribute test: null but in Tomcat 5.0.28: StandardContext[/test]test: In init TestServlet StandardContext[/test]test: Attribute test: test StandardContext[/test]test: In destroy TestServlet StandardContext[/test]test: Attribute test: test
*** This bug has been marked as a duplicate of 33463 ***