jQuery in Action, 3rd edition
The moose likes Tomcat and the fly likes java.net.ConnectException: Connection refused Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "java.net.ConnectException: Connection refused" Watch "java.net.ConnectException: Connection refused" New topic

java.net.ConnectException: Connection refused

preethi Ayyappan
Ranch Hand

Joined: Oct 04, 2007
Posts: 518

I am running tomcat in trixbox (cent os package).when I start tomcat,it starts fine and working .But when i stop tomcat,
the following error displayed and i am unable to stop the tomcat.

Mar 22, 2009 7:11:38 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)

Any help to solve this problem would be appreciated.

Kees Jan Koster
JavaMonitor Support

Joined: Mar 31, 2009
Posts: 251
Dear preethi,

This is most likely a configuration issue caused by the repackaging done for the RPM package. I really dislike yum/rpm/apt packages for Tomcat. The mostly cause more problems than they solve and to top it off they stick you with old versions of Tomcat.

Best install a real Tomcat from Apache.org and these problems tend to go away.

If you want to debug and solve this problem yourself, check out the configured stop port (default 8005) in Tomcat's server.xml. Look for a line like: <Server port="8005" shutdown="SHUTDOWN">. To check if Tomcat is listening on that port, use netstat as discussed here: http://java-monitor.com/forum/showthread.php?t=22

Kees Jan

Java-monitor, JVM monitoring made easy <- right here on Java Ranch
I agree. Here's the link: http://aspose.com/file-tools
subject: java.net.ConnectException: Connection refused
It's not a secret anymore!