解决ubuntu下tomcat关闭异常 8005端口问题

  • ./shutdown.sh 关闭tomcat时 遇到如下错误
SEVERE: Could not contact localhost:8005. Tomcat may not be running.
Dec 14, 2017 11:10:15 AM org.apache.catalina.startup.Catalina stopServer
SEVERE: Catalina.stop: 
java.net.ConnectException: Connection refused (Connection refused)
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java.net.Socket.connect(Socket.java:589)
    at java.net.Socket.connect(Socket.java:538)
    at java.net.Socket.(Socket.java:434)
    at java.net.Socket.(Socket.java:211)
    at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:451)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:400)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:487)

  • 查看端口 并没有发现8005端口,即为8005端口未运行,使用命令netstat -ant 发现 没有找到8005端口
root@VM-248-9-ubuntu:/home/ubuntu/apache-tomcat-8.0.47/bin# netstat -ant
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 0.0.0.0:8009            0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN     
tcp        0    388 10.104.248.9:22         117.32.216.63:23990     ESTABLISHED
tcp      409      0 10.104.248.9:8080       117.32.216.63:34145     CLOSE_WAIT 
tcp      409      0 10.104.248.9:8080       117.32.216.63:34551     CLOSE_WAIT 
tcp6       0      0 :::22                   :::*                    LISTEN     

  • 解决办法

修改$JAVA_HOME/jre/lib/security/Java.security 文件中 securerandom.source 配置项:

securerandom.source=file:/dev/random
修改为:
securerandom.source=file:/dev/urandom

你可能感兴趣的:(解决ubuntu下tomcat关闭异常 8005端口问题)