我经常遇到UnknownHostException。我该如何解决这个问题?我在机器的主机文件中添加了IP。 (在/ etc /主机)。
52.202.186.221 us-east-api.getstream.io
54.165.144.222 us-east-api.getstream.io
52.72.192.142 us-east-api.getstream.io
添加频率后,频率降低但仍然有例外。
执行:
2017-04-27 08:07:55,502 ERROR [notes-activity-service] de.notes.activity.rest.ActivityBaseResource - Exception Occurred : Internal server error
java.net.UnknownHostException: us-east-api.getstream.io: Name or service not known
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928)
at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323)
at java.net.InetAddress.getAllByName0(InetAddress.java:1276)
at java.net.InetAddress.getAllByName(InetAddress.java:1192)
2017-04-27 08:07:55,502 ERROR [notes-activity-service] de.notes.activity.rest.ActivityBaseResource - Exception Occurred : Internal server error
at java.net.InetAddress.getAllByName(InetAddress.java:1126)
at org.apache.http.impl.conn.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:45)
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:111)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at io.getstream.client.apache.repo.StreamActivityRepository.getActivities(StreamActivityRepository.java:153)
at io.getstream.client.apache.repo.StreamRepositoryImpl.getActivities(StreamRepositoryImpl.java:194)
at io.getstream.client.service.FlatActivityServiceImpl.getActivities(FlatActivityServiceImpl.java:61)
at de.notes.activity.rest.ActivityGetResource.getCarbookActivities(ActivityGetResource.java:101)
答案 0 :(得分:0)
尝试将主机名更改为“api.getstream.io”。虽然您可以使用这些IP地址直接在AWS上连接到我们的数据中心,但我们系统的性质意味着IP地址可能过时,因此您应该真正依赖DNS解析来连接到Stream。 / p>