1. 程式人生 > >tomcat shutdown.sh結束不了,Could not contact localhost:8005

tomcat shutdown.sh結束不了,Could not contact localhost:8005

tomcat shutdown.sh結束不了,Could not contact localhost:8005

2018年01月25日 11:22:49 夢裡斷魂 閱讀數:2493更多

個人分類: exception

使用./shutdown.sh關閉Tomcat,有時會關閉成功,有時會出現關閉錯誤;

Jul 06, 2017 10:57:37 AM org.apache.catalina.startup.Catalina stopServer 
SEVERE: Could not contact localhost:8005. Tomcat may not be running. 
Jul 06, 2017 10:57:37 AM 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:339) 
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200) 
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182) 
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) 
at java.net.Socket.connect(Socket.java:579) 
at java.net.Socket.connect(Socket.java:528) 
at java.net.Socket.(Socket.java:425) 
at java.net.Socket.(Socket.java:208) 
at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:450) 
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:606) 
at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:400) 
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:487)

這個問題是Tomcat記憶體導致的,可以修改下Tomcat記憶體,切換到bin目錄下面,使用

vi catalina.sh

修改catalina.sh檔案,在位置cygwin=false前,插入以下內容

JAVA_OPTS=”-Xms512m -Xmx1024m -Xss2048K -XX:PermSize=256m -XX:MaxPermSize=512m”

重啟Tomcat即可。