2013-06-07

jvm

JDK 7 for OSX: java.net.UnknownHostException

TLDR: Add the name of your machine to /etc/hosts.

When working on a play app in JDK 7 on OSX using JDK 7: a java.net.UnknownHostException occurred (nodename nor servname provided, or not known). The specific versions involved.

Component Version
OSX 10.7.5
Play 2.1.1
Java Full Version 1.7.0_21-b12
An example of how this looked when I ran a new play app and hit the server in a browser

[app] $ run



--- (Running the application from SBT, auto-reloading is enabled) ---



22:26:54,124 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]

22:26:54,124 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]

22:26:54,124 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [jar:file:/Users/cs/Desktop/play-2.1.1/repository/local/play/play_2.10/2.1.1/jars/play_2.10.jar!/logback.xml]

22:26:54,138 |-INFO in ch.qos.logback.core.joran.spi.ConfigurationWatchList@162ccef8 - URL [jar:file:/Users/cs/Desktop/play-2.1.1/repository/local/play/play_2.10/2.1.1/jars/play_2.10.jar!/logback.xml] is not of type file

22:26:54,165 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set

22:26:54,200 |-ERROR in ch.qos.logback.core.util.ContextUtil@57c80727 - Failed to get local hostname java.net.UnknownHostException: MyMacBookAir: MyMacBookAir: nodename nor servname provided, or not known

	at java.net.UnknownHostException: MyMacBookAir: MyMacBookAir: nodename nor servname provided, or not known

This is a bug that has been reported, and the workaround for the moment is to add the name of your machine to your /etc/hosts file.


		127.0.0.1 		MyMacBookAir

comments powered by Disqus