It takes seven or eight minutes to deploy tomcat9 and java8 under ubuntu16.04

1. The environment is as follows

Ubuntu16.04  +tomcat9+openjdk1.8

Second, the problem

Execute ./startup.sh under the bin of tomcat, there is no problem as shown below

root@bogon:/usr/apache-tomcat-9.0.8/bin# ./startup.sh
./catalina.sh: 110: ./catalina.sh: -Djava.security.egd=file:/dev/./ urandom: not found
Using CATALINA_BASE: /usr/apache-tomcat-9.0.8
Using CATALINA_HOME: /usr/apache-tomcat-9.0.8
Using CATALINA_TMPDIR: /usr/apache-tomcat-9.0.8/temp
Using JRE_HOME: /usr
Using CLASSPATH: /usr/apache-tomcat-9.0.8/bin/bootstrap.jar:/usr/apache-tomcat-9.0.8/bin/tomcat-juli.jar
Tomcat started.
But visit http:// ip:8080 is always in the waiting state. At this time, there is only one default ROOT project under tomcat. At this time, it is thought that the port is occupied, and there will be many false impressions.

For example: your tomcat has not been started yet. At this time, when you execute ./shutdown.sh, it will say that the connection is refused, and there is a problem with the port. This is because your service has not been fully started, and the shutdown operation must be monitored. Your service is not running, no need to close the error message

3. Solutions

This is still thanks to the majority of technical personnel. This problem has not been unexpectedly encountered by many people. The following is the idea of ​​​​solving the problem.

1: View the startup log catalina.2018-05-08.log of tomcat, as shown in the following figure

The startup port initialization is OK. The problem is in the following log. It is found that SessionIdGeneratorBase.createSecureRandom Creation of SecureRandom instance takes a long time to create a random security instance.

08-May-2018 19:16:37.013 WARNING [main] org.apache.catalina.util.SessionIdGeneratorBase.createSecureRandom Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [431,234] milliseconds.
08-May-2018 19:16:37.098 INFO [main] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/usr/apache-tomcat-9.0.8/webapps/manager] has finished in [431,592] ms

2: The solution is to go to the installation directory of openjdk as shown below

/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/security/java.security

Modify the relevant content in the file, as shown below

That is, change securerandom.source=file:/dev/random to securerandom.source=file:/dev/./urandom to save and restart the tomcat service, the problem is solved

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325010310&siteId=291194637