1. 在Tomcat环境中解决:
可以通过配置 JRE 使用非阻塞的 Entropy Source:
在 catalina.sh 中加入这么一行:-Djava.security.egd=file:/dev/urandom 即可。
2. 在 JVM 环境中解决(本人使用此方法):
打开jdk安装路径 $JAVA_PATH/jre/lib/security/java.security 这个文件,找到下面的内容:
securerandom.source=file:/dev/random
替换成:
securerandom.source=file:/dev/urandom
3.第三种也是配置第二种的时候配置文件指明的
java -Djava.security.egd=file:/dev/urandom MainClass
#springboot项目
java -Djava.security.egd=file:/dev/urandom -jar xxx.jar