-----BEGIN PGP SIGNED MESSAGE-----
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:
> java.net.ConnectException: Connection refused
>         at java.net.PlainSocketImpl.socketConnect(Native Method)
>         at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
>         at
> java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
>         at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
>         at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
>         at java.net.Socket.connect(Socket.java:519)
>         at java.net.Socket.connect(Socket.java:469)
>         at java.net.Socket.<init>(Socket.java:366)
>         at java.net.Socket.<init>(Socket.java:180)
>         at
> org.apache.catalina.startup.Catalina.stopServer(Catalina.java:395)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:597)
>         at
> org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:344)
>         at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:435)
> I under stood why i am getting this error. Actually i am starting tomcat
> using a script startUp.sh(Which is provided by tomcat). But it is taking
> some time to load in backend. Before it loads completely if i issue
> shutdown.sh 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 shutdown.sh 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.

Regards,
- -- 
Thomas Freitag
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEARECAAYFAk199M8ACgkQGE5pHr3PKuUPuwCZAa+QpdLm1HT6pwcMEuUC1D7l
DxIAn3bsKzCRSAy/2yl3MYZN6aINn7im
=a7I5
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to