AWS Java客户端的未知主机异常?

时间:2012-03-15 15:42:46

标签: java amazon-web-services

是否有其他人遇到此异常?我们昨晚在负载测试中看到了它。主机名是正确的,通常正常。它昨晚刚开始抛出这个例外。无论是amanzon上的随机DNS失败,还是Aws SDK for Java在加载时都会出现意外情况。

> Caused by: java.net.UnknownHostException: sdb.amazonaws.com
    at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
    at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:867)
    at java.net.InetAddress.getAddressFromNameService(InetAddress.java:1246)
    at java.net.InetAddress.getAllByName0(InetAddress.java:1197)
    at java.net.InetAddress.getAllByName(InetAddress.java:1128)
    at java.net.InetAddress.getAllByName(InetAddress.java:1064)
    at org.apache.http.impl.conn.DefaultClientConnectionOperator.resolveHostname(DefaultClientConnectionOperator.java:242)
    at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:130)
    at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:149)
    at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:121)
    at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:561)
    at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:415)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:754)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:732)
    at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:266)

2 个答案:

答案 0 :(得分:0)

以下列方式更改/ etc / hosts:

127.0.0.1 localhost localhost.localdomain

127.0.0.1 localhost localhost.localdomain add-your-localhost-name-here

答案 1 :(得分:0)

我遇到了同样的问题 Caused by: java.net.UnknownHostException: ec2.sa-east-1.amazonaws.com同时执行lein pallet up将文件上传到aws桶/或尝试获取远程机器的ips时。

<强> 1。首先尝试,

清理项目,等待几分钟/小时,然后使用相同的aws配置重新启动lein pallet up -P aws-ec2

<强> 2。第二次尝试,

为单个lein pallet up -P aws-ec2而不是整个群集运行groups