The following error message appears when you execute the close Tomcat command on the server
[root@server classes]# service tomcat restart
Stopping Tomcat service: Using CATALINA_BASE: /opt/tomcat
Using CATALINA_HOME: /opt/tomcat
Using CATALINA_TMPDIR: /opt/tomcat/temp
Using JRE_HOME: /usr
Apr 17, 2011 10:11:53 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.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:310)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:176)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:163)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:381)
at java.net.Socket.connect(Socket.java:537)
at java.net.Socket.connect(Socket.java:487)
at java.net.Socket.<init>(Socket.java:384)
at java.net.Socket.<init>(Socket.java:198)
at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:421)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:337)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:415)
Then check the relevant information. On the stack overflow website, it says that it may be a CentOS firewall problem. Check the firewall configuration file, and the 8005 port has been configured. Then close the firewall, and it is still connection refused
Then use the telnet command to test. First test telnet 127.0.0.1 80, normal, then telnet 127.0.0.1 8005, normal, later test telnet localhost 80, abnormal connection refused, telnet localhost 8005, also abnormal, connection refused
It should be the problem of localhost parsing
#vim /etc/hosts
View the local hosts configuration file
127.0.0.1 IT2YWMHA01 localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
Modify localhost, add it to 127.0.0.1, and change it to
127.0.0.1 IT2YWMHA01 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost.localdomain localhost6 localhost6.localdomain6
Test #sh shutdown.sh, now it can shut down Tomcat normally and no longer prompts Connection refused.