错误信息:
正常启动tomcat,但是无法访问,shutdown时输出
# sh shutdown.sh
Using CATALINA_BASE: /usr/tomcat/apache-tomcat-8.5.11
Using CATALINA_HOME: /usr/tomcat/apache-tomcat-8.5.11
Using CATALINA_TMPDIR: /usr/tomcat/apache-tomcat-8.5.11/temp
Using JRE_HOME: /usr/java/jdk1.8.0_161/jre
Using CLASSPATH: /usr/tomcat/apache-tomcat-8.5.11/bin/bootstrap.jar:/usr/tomcat/apache-tomcat-8.5.11/bin/tomcat-juli.jar
Jan 21, 2018 3:26:01 PM org.apache.catalina.startup.Catalina stopServer
SEVERE: Could not contact localhost:8005. Tomcat may not be running.
Jan 21, 2018 3:26:01 PM 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.<init>(Socket.java:434)
at java.net.Socket.<init>(Socket.java:211)
at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:476)
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:408)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:497)
查看进程发现tomcat仍在运行
root 1939 1 3 15:27 pts/0 00:00:26 /usr/java/jdk1.8.0_161/jre/bin/java -Djava.util.logging.config.file=/usr/tomcat/apache-tomcat-8.5.11/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -classpath /usr/tomcat/apache-tomcat-8.5.11/bin/bootstrap.jar:/usr/tomcat/apache-tomcat-8.5.11/bin/tomcat-juli.jar -Dcatalina.base=/usr/tomcat/apache-tomcat-8.5.11 -Dcatalina.home=/usr/tomcat/apache-tomcat-8.5.11 -Djava.io.tmpdir=/usr/tomcat/apache-tomcat-8.5.11/temp org.apache.catalina.startup.Bootstrap start
解决办法:
kill掉tomcat的进程(进程号自己查看)
kill -9 1939
找到java安装目录
/usr/java/jdk1.8.0_161/jre/lib/security/
找到文件java.security,文本方式打开,找到securerandom.source=file:/dev/random
修改为 securerandom.source=file:/dev/./urandom
即可解决问题
网友评论