4

In regards to this question Play Framework GUID why do I have to change my hosts file? I was having a similar issue while running a test in fedora which returned the following error

[error] (*:testListeners) java.net.UnknownHostException: fedora: fedora: Name 
or service not known

I added the line

127.0.0.1 localhost fedora

to my /etc/hosts file, which fixed this, but why should this have to be done in the first place?

Community
  • 1
  • 1
user1876508
  • 12,864
  • 21
  • 68
  • 105

1 Answers1

5

Play server loads EhCache. When EhCache is loaded (specifically net.sf.ehcache.Cache) it attempts to determine the address for localhost which is used in a process to create GUIDs identifying the cache instances created. EhCache does this by calling InetAddress.getLocalHost(). This method searches your host file for an entry matching the hostname set for the local machine, if it doesn't find one it throws an UnknownHostException.

The fix, as demonstrated in an answer to the question you linked, is to set a host entry for the local hostname.

Dev
  • 11,919
  • 3
  • 40
  • 53
  • 1
    It's a bit more tricky than that for folks on a DHCP network where our hostnames aren't fixed. For me, this was working ten minutes ago, now, it's not. I'm guessing my lease renewed and I got a new host name or something. – PlexQ Feb 28 '14 at 19:56