Meaningless Drivel is fun!*
The moose likes Tomcat and the fly likes contextDestroyed- odd behaviour? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "contextDestroyed- odd behaviour?" Watch "contextDestroyed- odd behaviour?" New topic
Author

contextDestroyed- odd behaviour?

John Jones
Greenhorn

Joined: Feb 17, 2005
Posts: 1
I have a very simple class that implements ServletContextListener.
When Tomcat is shut down, contextDestroyed is run, but the context variables are already null when I try to access them. Is this the appropriate behaviour? I would have thought they would not destroyed until after contextDestroyed finishes running.
I wrote a simple jsp page as well to make sure that I could access the variable before shutdown.
I am running Tomcat 5.5.7 on Windows 2000.

Here is my code:



Craig Jackson
Ranch Hand

Joined: Mar 19, 2002
Posts: 405
Did you configure your implementation class in the deployment descriptor of your web application?

And the "test" JSP page is included in the same web application?
Craig Jackson
Ranch Hand

Joined: Mar 19, 2002
Posts: 405
This sounds more like a JSP/Servlet issue than a Apache/Tomcat?
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

John,
I just tested your code in TC5.28 and it seems to be working fine.
Here is the output to catalina.out, generated when reloading the app from the html manager in Tomcat:

==> catalina.out <==
- Reloading this Context has started
test = This is a test


I've bundled the test into a war file:
http://simple.souther.us/con-lis-test.war
Try with this war file.

If I get a chance later, I'll try in 5.5.7


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
Don't get me started about those stupid light bulbs.
 
subject: contextDestroyed- odd behaviour?
 
Similar Threads
When HttpSessionAttributeListener and HttpSessionBindingListener methods are called?
Servlet filter question
context variable in action servlet
A small chicken and the egg situation!
Cannot get HttpSessionBindingListener method valueBound to trigger