When I run command:

catalina.sh stop

I receive error:

 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:529)
    at java.net.Socket.connect(Socket.java:478)
    at java.net.Socket.<init>(Socket.java:375)
    at java.net.Socket.<init>(Socket.java:189)
    at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:456)
    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:352)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)

What can be the reason? Thanks.

migrated from stackoverflow.com Dec 27 '11 at 16:15

This question came from our site for professional and enthusiast programmers.

  • I can start tomcat without any problems. – user710818 Dec 27 '11 at 14:42
  • Are you positive it started up correctly? I get this error when I try to stop a server that isn't started. – AHungerArtist Dec 27 '11 at 14:52

Possible reasons

  1. Tomcat is not running. In this case do nothing.
  2. Tomcat go stuck. In this case kill it. I hope it will start working after restart. If not try to check the stdout and error logs. Probably the momory is over or no free space on disk or all filehandlers are used...
  3. There is firewall (?) or some kind of routing problems. It is hard to imagine firewall inside one machine but if for example you have several network cards and tomcat somehow is connected to one of them but the stop utility tries to connect to other it fails.

Probably other reasons are possible. But again, #1 & #2 make more sense.

If problem still exists try to examine logs. If something strange appears in logs but you do not know what to do try to post the logs here.

  • 1 and 2 are usually enough – Alfabravo Dec 27 '11 at 14:53
  • 1, 2 don't help. – user710818 Dec 27 '11 at 15:02
  • 3. There is firewall (?) or some kind of routing problems. It is not an answer. If I can do server start - which firewall or routing problems? – user710818 Dec 27 '11 at 15:03
  • Dear @user710818, I know that it is not an answer. But if you want better answer try to give more information. Check your log files. The exception is thrown from TCP layer. Client cannot connect to server. Why? Server does not exist on is not accessible or is not listening to the port. BTW yet another reason: missconfiguration of management port. But unfortunately I have no idea where this port is configured. I believe somewhere in server.xml – AlexR Dec 27 '11 at 15:05

Check your /etc/hosts file; the host config is likely incorrect. I just encountered the same issue, and resolved it by correcting that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.