Tag - DNS

Linux DNS    2019-04-04 11:42:07    9    0    0

访问百度域名UnknownHost

百度这么叼, 也会有域名无法访问的时候?

最近就碰上这个事情了, 调用百度的 Http API, 结果报了个 UnknownHostException 异常。

  1. java.net.UnknownHostException: api.baidu.com: unknown error
  2. at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method) ~[na:1.8.0_101]
  3. at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928) ~[na:1.8.0_101]
  4. at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323) ~[na:1.8.0_101]
  5. at java.net.InetAddress.getAllByName0(InetAddress.java:1276) ~[na:1.8.0_101]
  6. at java.net.InetAddress.getAllByName(InetAddress.java:1192) ~[na:1.8.0_101]
  7. at java.net.InetAddress.getAllByName(InetAddress.java:1126) ~[na:1.8.0_101]
  8. at org.apache.http.impl.conn.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:45) ~[httpclient-4.5.6.jar!/:4.5.6]
  9. at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java