Graceful shutdown of Tomcat - How? [message #522184] |
Sat, 20 March 2010 18:50  |
Eclipse User |
|
|
|
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
|
|
|
Re: Graceful shutdown of Tomcat - How? [message #522365 is a reply to message #522184] |
Mon, 22 March 2010 09:43   |
Eclipse User |
|
|
|
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
|
|
|
|
Re: Graceful shutdown of Tomcat - How? [message #780556 is a reply to message #780547] |
Wed, 18 January 2012 10:47  |
Eclipse User |
|
|
|
On 1/18/2012 9:55 AM, Matteo TURRA wrote:
> Why there is no option to shutdown tomcat gracefully using SHUTDOWN
> command on "Tomcat admin port" (default 8005), like shutdown.bat/.sh does?
>
In the Servers view, the "Stop" context menu command and the "Stop the
server" icon effectively do the same thing as shutdown.bat. After
executing one of these, you can look in the Debug view of the Debug
perspective and find the "Tomcat server launch" which asked Tomcat to
terminate (i.e. calls the org.apache.catalina.startup.Bootstrap class
with a "stop" command which is what shutdown.bat does).
Cheers,
Larry
|
|
|
Powered by
FUDForum. Page generated in 0.26031 seconds