Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use JDK1.8 to solve the problem of error reporting in Tomcat

2025-03-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

What this article shares with you is about how to use JDK1.8 to solve the problem of reporting errors in Tomcat. The editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

Tomcat (. / shutdown.sh) reported an error, and you happen to be using JDK1.8. The following may help you.

I am a rookie. In the process of learning to install tomcat, I encountered the following error

[root@localhost tomcat] # bin/shutdown.sh

Using CATALINA_BASE: / usr/local/tomcat

Using CATALINA_HOME: / usr/local/tomcat

Using CATALINA_TMPDIR: / usr/local/tomcat/temp

Using JRE_HOME: / usr

Using CLASSPATH: / usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar

December 12, 2019 5:22:27 afternoon org.apache.catalina.startup.Catalina stopServer

Serious: Could not contact [localhost: [8005]]. Tomcat may not be running.

December 12, 2019 5:22:27 afternoon org.apache.catalina.startup.Catalina stopServer

Critical: Catalina.stop:

Java.net.ConnectException: deny connection (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:504)

At sun.reflect.NativeMethodAccessorImpl.invoke0 (NativeMethod)

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)

1. The environment for installing Tomcat and the installation package:

(1) operating system: CentOS Linux release 7.7.1908 (Core)

(2) JDK:jdk-8u221-linux-x64.tar.gz

(3) Tomcat:apache-tomcat-8.5.45.tar.gz

2. Tomcat reports an error:

(1) tomcat was started successfully. Use ps-ef | grep tomcat found that the process was not started.

(2) stop tomcat first and find that the error message is as follows

(3) Baidu has tried all kinds of tutorials for a long time, and finally saw a feasible way in the tutorials of a big boss. He found the answer in stackoverflow.

Boss tutorial link:

Https://blog.csdn.net/qq_31772441/article/details/80472968

Stackoverflow link: https://stackoverflow.com/questions/36566401/severe-could-not-contact-localhost8005-tomcat-may-not-be-running-error-while

(4) solution:

Find the installation path of jdk1.8.xx and change the "securerandom.source=file:/dev/random" in the "java.security" file under its subdirectory / jre/lib/security/ to "securerandom.source=file:/dev/./urandom".

Third, the specific solution process:

(1) find the installation path of JDK and use the command which java (I know the installation path of JDK myself, and those who don't know can use the command)

(2) ls-lrt / usr/local/java

(3) ls-lrt / etc/alternatives/java, the final result is the path of jdk (the first part is)

(4) enter the cd / usr/lib/jvm/java-1.8.0-openjdk-1.8.0.222.b03-1.el7.x86_64/jre/lib/security/ directory (maybe the name of your directory is different from mine, and I tried to find it myself)

(5) vi java.security enters the command mode of the vim editor

(6) enter "/" after entering, and then enter the keyword "securerandom.source=file:/dev/random" to find the corresponding content.

(7) press "a" to enter the input mode, and change "securerandom.source=file:/dev/random" to "securerandom.source=file:/dev/./urandom". Finally, press esc, enter ": wq!" and enter enter.

(8) close first, then open, access the web page successfully

The above is how to use JDK1.8 to solve the problem of reporting errors in Tomcat. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report