Tomcat stuck in "INFO: Deploying web application directory..." solution when starting

For the first time, I encountered the situation that Tomcat was stuck on the Linux server startup. The situation was very simple. After tomcat started, it was stuck in INFO: Deploying web application directory... This sentence has not been tested for how long it will be stuck. Google, baidu did not find a solution.

Fortunately, UCloud's technical support staff gave a solution.

Find the jdk1.x.x_xx/jre/lib/security/Java.security file, find the securerandom.source setting item in the file, and change it to: securerandom.source

=file:/dev/./urandom

The content can be found because of this reason not only can cause tomcat to get stuck, but also cause weblogic to start slowly.


Linux or some unix systems provide random number devices are /dev/random and /dev/urandom, the two are different, urandom security Not as high as random, but random takes time intervals to generate random numbers. jdk calls random by default.


Later, I finally found the title Avoiding JVM Delays Caused By Random Number Generation in Monitoring and Troubleshooting in weblogic's official documentation. The excerpt is as follows:

The library used for random number generation in Sun's JVM relies on /dev/random by default for UNIX platforms. This can potentially block the Oracle WebLogic Communication Services process because on some operating systems /dev/random waits for a certain amount of "noise" to be generated on the host machine before returning a result. Although /dev/random is more secure, Oracle recommends using /dev/urandom if the default JVM configuration delays Oracle WebLogic Communication Services startup.

To determine if your operating system exhibits this behavior, try displaying a portion of the file from a shell prompt:

head -n 1 /dev/random
Open the $JAVA_HOME/jre/lib/security/java.security file in a text editor.

Change the line:

securerandom.source=file:/dev/random
to read:

securerandom.source=file:/dev/urandom
Save your change and exit the text editor.
It says: You can check whether your system will provide pseudo-random numbers through head -n 1 /devrandom. OK just this, tried it and sure enough, after the first start of the server, this can provide a value quickly, but when called again the wait happens.


Solution:


Permanent: Oracle says to modify the $JAVA_HOME/jre/lib/security/java.security file and replace securerandom.source=file:/dev/random with securerandom.source=file:/dev/urandom. Effective for all applications using the JVM. (There is a problem with this permanent method, that is, it should actually be set to securerandom.source=file:/dev/./urandom, otherwise it will not take effect)


DOMAIN Temporary: modify the startWeblogic.sh file, JAVA_OPTIONS="${ SAVE_JAVA_OPTIONS} -Djava.security.egd=file:/dev/./urandom"


Successor SecureRandom test learning


Write JAVA class as follows, run the test, the first time is normal, the second time waits, and the first time after restarting the server is normal. The startup parameter -Djava.security.egd=file:/dev/./urandom is normal

Guess you like

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