Horstus Horstus - 4 months ago 33
Java Question

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

InetAddress fails to resolve the following domains:

kymcolux.com
shencan.net
zoocore.com


Tested on my home computer and a VPS with:

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


https://httpstatus.io/ also can't fetch the URLs.

InetAddress throws:

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). Still the same result.

Any ideas? Thanks!

Answer

See if it works when you append www to the urls as shown below:

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