简体   繁体   English

InetAddress无法解析某些域,引发java.net.UnknownHostException,但是域实际上可以在浏览器中工作

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

InetAddress fails to resolve the following domains: InetAddress无法解析以下域:

kymcolux.com
shencan.net
zoocore.com

Tested on my home computer and a VPS with: 在我的家用计算机和VPS上进行了以下测试:

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

https://httpstatus.io/ also can't fetch the URLs. https://httpstatus.io/也无法获取网址。

InetAddress throws: InetAddress引发:

java.net.UnknownHostException: zoocore.com: unknown error
    at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
    at java.net.InetAddress$2.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)

Strangely they work in my browser. 奇怪的是,它们在我的浏览器中工作。

UPDATE Tried different DNS servers (Google & OpenDNS). 更新尝试了不同的DNS服务器(Google和OpenDNS)。 Still the same result. 结果还是一样。

Any ideas? 有任何想法吗? Thanks! 谢谢!

如下所示,将www附加到网址后,看看它是否有效:

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

The following sites are not even reachable from my browser without adding the www. 如果不添加www,则无法从我的浏览器访问以下站点。 initially. 原来。 You might be able to open them in your browser if you previously visited these sites. 如果您以前访问过这些站点,则可以在浏览器中打开它们。

Note the following output: 注意以下输出:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Java:.netAddress.getLocalHost(); 抛出 java.net.UnknownHostException - Java: InetAddress.getLocalHost(); throws java.net.UnknownHostException java.net.UnknownHostException:无法在 Vertx 中解析 - java.net.UnknownHostException: failed to resolve in Vertx 的java.net.UnknownHostException - java.net.UnknownHostException java.net.UnknownHostException:Test:Test:unknown error无法获取VMID的本地InetAddress - java.net.UnknownHostException: Test: Test: unknown error Failed to get local InetAddress for VMID Tomcat 9 webapp 的 InetAddress.getByName 不工作 (java.net.UnknownHostException) - Tomcat 9 webapp's InetAddress.getByName not working (java.net.UnknownHostException) 带有phantomjs的browserMob代理针对HTTP协议抛出“ java.net.UnknownHostException” - browserMob proxy with phantomjs throws “java.net.UnknownHostException” for http protocol Keycloak docker 容器在启动期间抛出`java.net.UnknownHostException` - Keycloak docker container throws `java.net.UnknownHostException` during startup java.net.UnknownHostException:无法解析主机没有与主机名关联的地址 - java.net.UnknownHostException: Unable to resolve host No address associated with hostname java.net.UnknownHostException-Jsoup - java.net.UnknownHostException - Jsoup 获取java.net.UnknownHostException: - Getting java.net.UnknownHostException:
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM