Horstus Horstus - 1 year ago 116
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:


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.

Tried different DNS servers (Google & OpenDNS). Still the same result.

Any ideas? Thanks!

Answer Source

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

InetAddress addr1 = InetAddress.getByName("www.kymcolux.com");
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download