Play框架GUID

15

我创建了一个Play应用程序。当我运行该应用程序时,无论是在开发环境还是生产环境中,都会出现以下错误:

07:59:58,445 INFO  ~ Precompiling ...
08:00:08,884 ERROR ~ Unable to set localhost. This prevents creation of a GUID. Cause was: sys3: sys3: Name or service not known
java.net.UnknownHostException: sys3: sys3: Name or service not known
    at java.net.InetAddress.getLocalHost(InetAddress.java:1438)
    at net.sf.ehcache.Cache.<clinit>(Cache.java:155)
    at net.sf.ehcache.config.ConfigurationHelper.createCache(ConfigurationHelper.java:298)
    at net.sf.ehcache.config.ConfigurationHelper.createDefaultCache(ConfigurationHelper.java:214)
    at net.sf.ehcache.CacheManager.configure(CacheManager.java:552)
    at net.sf.ehcache.CacheManager.init(CacheManager.java:323)
    at net.sf.ehcache.CacheManager.<init>(CacheManager.java:279)
    at net.sf.ehcache.CacheManager.create(CacheManager.java:641)
    at play.cache.EhCacheImpl.<init>(EhCacheImpl.java:31)
    at play.cache.EhCacheImpl.newInstance(EhCacheImpl.java:41)
    at play.cache.Cache.init(Cache.java:241)
    at play.Play.start(Play.java:511)
    at play.Play.init(Play.java:300)
    at play.server.Server.main(Server.java:158)
Caused by: java.net.UnknownHostException: sys3: Name or service not known
    at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
    at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:866)
    at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1258)
    at java.net.InetAddress.getLocalHost(InetAddress.java:1434)
    ... 13 more

我不知道这是什么,它会做什么。如何解决这个问题。请帮助我。

1个回答

27

Java无法将mynap3解析为本地主机,因此您需要添加以下行:

127.0.0.1 localhost mynap3

将以下内容添加到您的/etc/hosts文件中

您可以通过执行以下操作来实现此目的

sudo bash
echo "127.0.0.1 localhost mynap3" >> /etc/hosts

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接