Here are some specific instructions to adjust just tomcat as per Henry's answer
create /etc/tomcat/fastersecurerandom.properties
securerandom.source=file:/dev/urandom
edit JAVA_OPTS
inside /etc/tomcat/tomcat.conf
JAVA_OPTS="-Djava.security.properties=/etc/tomcat/fastersecurerandom.properties"
FYI I found I could not set multiple JAVA_OPTS
with JAVA_OPTS="$JAVA_OPTS ..."
despite the commented out examples. Poor old confused tomcat 7 wouldn't start as per a warning in /var/log/messages
On different versions/flavours you may find variations on where is best to set the environment variables for tomcat. The best way to debug if they are taking affect is is to check the command running like this:
$ ps aux | grep java
tomcat 4821 4.7 13.9 2626888 263396 ? Ssl 22:31 0:23 /usr/lib/jvm/jre/bin/java -DJENKINS_HOME=/opt/jenkins/ -Xmx512m -Djava.net.preferIPv4Stack=true -Djava.net.preferIPv4Addresses=true -Djava.security.properties=/etc/tomcat/fastersecurerandom.properties -classpath /usr/share/tomcat/bin/bootstrap.jar:/usr/share/tomcat/bin/tomcat-juli.jar:/usr/share/java/commons-daemon.jar -Dcatalina.base=/usr/share/tomcat -Dcatalina.home=/usr/share/tomcat -Djava.endorsed.dirs= -Djava.io.tmpdir=/var/cache/tomcat/temp -Djava.util.logging.config.file=/usr/share/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager org.apache.catalina.startup.Bootstrap start