You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2005/03/08 18:34:11 UTC
DO NOT REPLY [Bug 33909] New: -
Context attributes get nullified before ServletContextListener
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: trajano@yahoo.com
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: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org