SecureRandom creation is slow, even in java 8
I was looking for this problem. I was under the impression that this is allowed in java 8. But all of a sudden, I started getting this issue in my new VM based on ubuntu 14.04.
2015-07-27 14: 56: 35.324 INFO 11809 --- [localhost-startStop-1] oacutil.SessionIdGeneratorBase: It took [167,833] milliseconds to instantiate SecureRandom to generate session ID using [SHA1PRNG].
And the java version
java version java version "1.8.0_45" Java (TM) SE Runtime Environment (build 1.8.0_45-b14) Java HotSpot (TM) 64-bit server VM (build 25.45-b02, mixed mode)
Ubuntu 14.04 server.
Another thing is, I am starting this java process as a spring boot app that has embedded tomcat running.
Any ideas what could be wrong? I even tried,
-Djava.security.egd = file: / dev /./ urandom option
source to share
Try replacing your embedded tomcat with a footboard by pasting the snippet below into your pom.xml:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId>
<version>2.1.0.RELEASE</version>
</dependency>
It works great for me. The SecureRandom issue is a tomcat issue that you can completely replace with another servlet container.
source to share