After upgrading one of my KVMs to Ubuntu Server 14.04 LTS, Tomcat 7 started to freeze while starting up with:
INFO: Deploying configuration descriptor /etc/tomcat7/Catalina/localhost/ROOT.xml
Only after several minutes, Tomcat generates the following message and starts accepting requests:
INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [295,490] milliseconds.
INFO: Server startup in 296882 ms
If you don’t have a requirement for strong cryptography in Tomcat, you might as well switch to the less secure non-blocking /dev/urandom source instead of /dev/random.
Create a file named setenv.sh in /var/lib/tomcat7/bin make it executable:
#!/bin/sh
export CATALINA_OPTS="-Djava.security.egd=file:/dev/./urandom"
..and restart Tomcat.
It will now restart within seconds thanks to the non-blocking random source.