Hey Frank,

I also thought that my ServletContextListener was being invoked 2 times, but
in reality Tomcat was actually deploying me application 2 times. I posted a
question regarding this a while back and never resolved it. When I try to
set the context path to something other than the name of my .war file, I end
up with the app being deployed 2 times. Once at the name of the war, and the
other where I specified. You can verify if your app is deployed more than
once by looking at the manager app.

-sean


-----Original Message-----
From: Frank Lawlor [mailto:[EMAIL PROTECTED]
Sent: Friday, March 07, 2003 12:29 PM
To: Tomcat
Subject: Re: How to listen for shutdown


I found the answer to my questions:

 

Documentation on ServletContextListener: 

http://developer.java.sun.com/developer/technicalArticles/Servlets/servl
etapi2.3/

 

In order to ge the servlet invoked, you need a <listener> tag, e.g., 

  <listener>

      <listener-class>com.foo.ControllerServlet</listener-class>

  </listener>

 

The appearance that I was not getting time to do my cleanup was due to a
couple of things:

 

  1) you need to be careful what you do since other threads, instances,
etc. are in the 
     process of disappearing.



  2) For some reason my shutdown methods (both contextDestroyed() and
destroy()) 
     were being called twice.  I think they were not completing
operation on the second
     call.  Adding a static variable to ignore the second call seems to
have fixed things.

 

 

  -- Frank


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to