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

使用./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.<init>(Socket.java:425)
        at java.net.Socket.<init>(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即可。

上一篇:apache重写规则 rewrite


下一篇:如何在服务(Service)程序中显示对话框