【问题标题】:InetAddress.getByName intermittently fails with System errorInetAddress.getByName 间歇性失败并出现系统错误
【发布时间】:2014-06-08 20:43:19
【问题描述】:

我有一些使用 InetAddress.getByName 的代码。间歇性地我得到一个UnknownHostException

java.net.UnknownHostException: google.com: System error
    at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
    at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:901)
    at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1293)
    at java.net.InetAddress.getAllByName0(InetAddress.java:1246)
    at java.net.InetAddress.getAllByName(InetAddress.java:1162)
    at java.net.InetAddress.getAllByName(InetAddress.java:1098)
    at java.net.InetAddress.getByName(InetAddress.java:1048)

执行nslookup google.com 有效,而失败本身只是偶尔发生。这可能是什么原因造成的?

【问题讨论】:

    标签: java nslookup


    【解决方案1】:

    试试看official java documentation

    抛出: UnknownHostException - 如果找不到主机的 IP 地址,或者为全局 IPv6 地址指定了 scope_id。

    【讨论】:

      猜你喜欢
      • 2018-02-08
      • 2022-07-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-04-18
      • 2011-10-21
      相关资源
      最近更新 更多