|
Re: Graceful shutdown of Tomcat - How? [message #522365 is a reply to message #522184] |
Mon, 22 March 2010 13:43 |
Larry Isaacs Messages: 1354 Registered: July 2009 |
Senior Member |
|
|
Mike wrote:
> Hi,
>
> I have Tomcat running from within Eclipse using WTP and can control
> startup and shutdown from the Servers View. However, when I click on
> Stop for a running Tomcat, the server shuts down but doesn't seem to do
> so gracefully, i.e. my 'listener-class' specified in 'web.xml' never
> gets to execute its 'contextDestroyed()' method (at least, I am not
> seeing my logs in the log file).
>
> When I run the same code in a standalone Tomcat installation, calling
> the 'startup.sh' and 'shutdown.sh' scripts manually from a console, the
> contextDestroyed() method is executed and I see my logging statements in
> the logfile.
>
> Is there a way to shutdown Tomcat gracefully from within WTP so that my
> listeners get to destroy themselves?
>
> Thanks
Startup and shutdown aren't really any different within Eclipse and
using external batch scripts. What is different is that within Eclipse,
the separate Tomcat instance may be configured a little differently from
the installed version. For details see the Tomcat FAQ[1]. Logging is
one of the areas that can easily differ. Probably the easiest way to
verify if your context listener is being called is to put a breakpoint
in the contextInitialized() and contextDestroyed() methods, then run in
debug mode and see if the breakpoints are hit.
Cheers,
Larry
[1] http://wiki.eclipse.org/WTP_Tomcat_FAQ
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03759 seconds