• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

contextDestroyed- odd behaviour?

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:



 
Ranch Hand
Posts: 405
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This sounds more like a JSP/Servlet issue than a Apache/Tomcat?
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
You don't know me, but I've been looking all over the world for. Thanks to the help from this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic