解决Tomcat无法正常运行,导致Service Unavailable的问题
- 问题描述:
Tomcat可以启动,但无法正常停止,访问Service Unavailable
- 启动正常
[root@izuf6h1i09ke9avl0zp3kqz bin]# ./catalina.sh start
Using CATALINA_BASE: /var/apache-tomcat-8.5.34
Using CATALINA_HOME: /var/apache-tomcat-8.5.34
Using CATALINA_TMPDIR: /var/apache-tomcat-8.5.34/temp
Using JRE_HOME: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.262.b10-0.el7_8.x86_64/jre
Using CLASSPATH: /var/apache-tomcat-8.5.34/bin/bootstrap.jar:/var/apache-tomcat-8.5.34/bin/tomcat-juli.jar
Tomcat started.
- 停止异常
[root@izuf6h1i09ke9avl0zp3kqz bin]# ./shutdown.sh
Using CATALINA_BASE: /var/apache-tomcat-8.5.34
Using CATALINA_HOME: /var/apache-tomcat-8.5.34
Using CATALINA_TMPDIR: /var/apache-tomcat-8.5.34/temp
Using JRE_HOME: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.262.b10-0.el7_8.x86_64/jre
Using CLASSPATH: /var/apache-tomcat-8.5.34/bin/bootstrap.jar:/var/apache-tomcat-8.5.34/bin/tomcat-juli.jar
Oct 25, 2020 11:02:42 PM org.apache.catalina.startup.Catalina stopServer
SEVERE: Could not contact [localhost:[8005]]. Tomcat may not be running.
Oct 25, 2020 11:02:42 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:607)
at java.net.Socket.connect(Socket.java:556)
at java.net.Socket.(Socket.java:452)
at java.net.Socket.(Socket.java:229)
at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:497)
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:406)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:498)
- 解决办法
找到jdk目录例如’’jdk1.8.0 /jre/lib/security/”,在该文件夹下打开编辑java.security文件
将 “securerandom.source=file:/dev/random”
修改为 “securerandom.source=file:/dev/./urandom ”
重启tomcat就可以了
版权声明:
本站所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自
最上级!
喜欢就支持一下吧