Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

contextDestroyed- odd behaviour?

 
John Jones
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 405
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 405
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This sounds more like a JSP/Servlet issue than a Apache/Tomcat?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic