Java
There might not be enough entropy from /dev/random causing blocking. Use a software solution like Haveged. Install haveged on ubuntu:
sudo apt-get install haveged
Check entropy on linux with:
cat /proc/sys/kernel/random/entropy_avail