DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG· RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=33909>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND· INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=33909 Summary: Context attributes get nullified before ServletContextListener Product: Tomcat 5 Version: 5.5.7 Platform: PC OS/Version: Windows XP Status: NEW Severity: normal Priority: P2 Component: Servlet & JSP API AssignedTo: tomcat-dev@jakarta.apache.org ReportedBy: [EMAIL PROTECTED] It seems that context attributes get nullified before ServletContextListener I have created a small ServletContextListener and this causes a NullPointerException on contextDestroyed. public class ProblemListener implements ServletContextListener { public void contextInitialized(ServletContextEvent arg0) { SimpleClass contextObject = new SimpleClass(); arg0.getServletContext().setAttribute("CONTEXT", contextObject); } public void contextDestroyed(ServletContextEvent arg0) { SimpleClass container = (SimpleClass) arg0.getServletContext ().getAttribute("CONTEXT"); container.setFoo("ABC!!!!"); arg0.getServletContext().removeAttribute("CONTEXT"); } } SimpleClass is a bean that as a getter and setter called Foo and a finalizer that does System.out.println("FINALIZE THIS"); The sample from Sun (near the bottom of http://java.sun.com/j2ee/tutorial/1_3- fcs/doc/Servlets4.html) sounds like it should not be null at that point. -- Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]