InetAddress 无法解析某些域,抛出 java.net.UnknownHostException,但域实际上在浏览器中有效

InetAddress can't resolve some domains, throws java.net.UnknownHostException, but domains actually work in the browser

InetAddress 无法解析以下域:

kymcolux.com
shencan.net
zoocore.com

在我的家用电脑和 VPS 上测试过:

InetAddress addr1 = InetAddress.getByName("kymcolux.com");

https://httpstatus.io/ 也无法获取 URL。

InetAddress 抛出:

java.net.UnknownHostException: zoocore.com: unknown error
    at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
    at java.net.InetAddress.lookupAllHostAddr(InetAddress.java:907)
    at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1302)
    at java.net.InetAddress.getAllByName0(InetAddress.java:1255)
    at java.net.InetAddress.getAllByName(InetAddress.java:1171)
    at java.net.InetAddress.getAllByName(InetAddress.java:1105)
    at java.net.InetAddress.getByName(InetAddress.java:1055)
    at Main.main(Main.java:16)

奇怪的是它们在我的浏览器中工作。

更新 尝试了不同的 DNS 服务器(Google 和 OpenDNS)。还是一样的结果。

有什么想法吗?谢谢!

当您将 www 附加到 url 时,看看它是否有效,如下所示:

InetAddress addr1 = InetAddress.getByName("www.kymcolux.com");

如果不添加 www,甚至无法从我的浏览器访问以下站点。最初。如果您之前访问过这些网站,您或许可以在浏览器中打开它们。

注意以下输出:

java.net.InetAddress.getByName("google.com");//google.com/216.58.208.238            
java.net.InetAddress.getByName("www.google.com");//www.google.com/216.58.210.196