tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Freitag <>
Subject Re: On stopping tomcat getting error
Date Mon, 14 Mar 2011 10:58:24 GMT
Hash: SHA1

Hello Raju,

On 14.03.11 um 03:16, laxmipathi raju wrote:
> While i am stopping tomcat i am getting the following error
> Mar 14, 2011 3:45:43 PM org.apache.catalina.startup.Catalina stopServer
> SEVERE: Catalina.stop:
> Connection refused
>         at Method)
>         at
>         at
>         at
>         at
>         at
>         at
>         at<init>(
>         at<init>(
>         at
> org.apache.catalina.startup.Catalina.stopServer(
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(
>         at java.lang.reflect.Method.invoke(
>         at
> org.apache.catalina.startup.Bootstrap.stopServer(
>         at org.apache.catalina.startup.Bootstrap.main(
> I under stood why i am getting this error. Actually i am starting tomcat
> using a script is provided by tomcat). But it is taking
> some time to load in backend. Before it loads completely if i issue
> i am getting this error.

Yes, you can get this error because Tomcat did not startup completly and
the shutdown port (8009 in default) is not opened yet. IIRC opening
the shutdown port (calling something like socket.accept() on
localhost:<shutdown port>) is more or less the last thing the tomcat
main thread does during the startup sequence. 
> Is there any why to check, whether tomcat is fully loaded in backend ?
> Can you please help me how to avoid this issue when stopping at any point of
> time.

Checking wether tomcat is fully loaded can be done by looking in the
tomcat logs for the tomcat startup message giving the time it took to
load tomcat and deploy all apps, which is logged with INFO level:
"Server startup in <n> ms"

Under unix an alternative to using is sending the SIGTERM
(using "kill <tomcat java pid>" does this in most unix shells) to the 
tomcat java process. Tomcat registers a shutdown handler to initiate a
clean shutdown. This clean shutdown might need some time (up to some
minutes) to complete, depending on your applications.

You should check if initiating a shutdown during startup works in your
environment. Otherwise waiting until the shutdownport (you could check
this using netstat) is opened may be another option.

- -- 
Thomas Freitag
Version: GnuPG v1.4.10 (GNU/Linux)


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message