ktbkea
Last Updated: February 25, 2016
·
21.26K
· junior-ales
0457965b9998d626e610a6279c852987

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

8 Responses
Add your response

9269

Cool! thanks man!

over 1 year ago ·
12941
Ed932e677b1f91d57d31dac78138b64c

The correct command should be:

$ echo "127.0.0.1 $HOSTNAME" | sudo tee -a /etc/hosts
over 1 year ago ·
14192

Thanks, It was very helpful for me.

over 1 year ago ·
14741
Ee691655d3257195f15bc7a420aec2c4

Thank you, It helped me :)

over 1 year ago ·
16145
2276d750b4e8c64d98ed538269096eaa

Many thanks for sharing this critical solution!

over 1 year ago ·
16354
302d1fbe248dd0bfcd091432b1e8800a

Thank you so much. It is nice to have this be such a highly published result on google.

over 1 year ago ·
17645
None

Thank you!

over 1 year ago ·
22157
None

Thanks! It works!

over 1 year ago ·