Play Framework 2 error: "nodename nor servname provided, or not known"
Then there was me fiddling with play framework... and in the first time I ran the sample application a beautiful stack trace with this exception poped up:
Caused by: java.net.UnknownHostException: [HOSTNAME_NAME]: nodename nor servname provided, or not known
After some research I found out that the issue is a bug in JDK 7 for OSX. It seems it doesn't recognize your hostname as localhost, so the workaround is pretty easy:
Add in your hosts file your hostname pointing to 127.0.0.1
$ sudo echo "127.0.0.1 [YOUR_HOSTNAME]" >> /etc/hosts
Important: do not delete your "127.0.0.1 localhost" entry in /etc/hosts
because it's used to configure the loopback interface when the system is booting
source: http://bit.ly/1a9B5it
Written by Junior Ales
Related protips
8 Responses
Cool! thanks man!
The correct command should be:
$ echo "127.0.0.1 $HOSTNAME" | sudo tee -a /etc/hosts
Thanks, It was very helpful for me.
Thank you, It helped me :)
Many thanks for sharing this critical solution!
Thank you so much. It is nice to have this be such a highly published result on google.
Thank you!
Thanks! It works!