Unknown Host exception from the AWS Java client?

匿名 (未验证) 提交于 2019-12-03 08:54:24

问题:

Has anyone else run across this exception? We saw it during a load test last night. The hostname is correct and normally works fine. It just started throwing this exception last night. Either it was a random DNS fail on amanzon's part or the Aws SDK for Java does something unexpected under load.

> 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) 

回答1:

Change /etc/hosts the following way:
old
127.0.0.1 localhost localhost.localdomain
new
127.0.0.1 localhost localhost.localdomain add-your-localhost-name-here



回答2:

I was facing the same problem Caused by: java.net.UnknownHostException: ec2.sa-east-1.amazonaws.com while doing lein pallet up to upload files to aws bucket/ or while trying to get ips of remote machines.

1. First try,

Cleaning project, Waiting for few minutes/hours and then refiring lein pallet up -P aws-ec2 with the same aws configuration worked for me.

2. Second try,

Run lein pallet up -P aws-ec2 for single groups instead of whole cluster.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!