In a web project .
I see the log:
hadoop.hbase.zookeeper.ZKConfig - java.net.UnknownHostException: example.com
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:850)
at java.net.InetAddress.getAddressFromNameService(InetAddress.java:1201)
at java.net.InetAddress.getAllByName0(InetAddress.java:1154)
at java.net.InetAddress.getAllByName(InetAddress.java:1084)
at java.net.InetAddress.getAllByName(InetAddress.java:1020)
at java.net.InetAddress.getByName(InetAddress.java:970)
but when I ping example.com, it's ok, I also telnet example.com 2181 successfully!
I found the similar question
so I run the DomainResolutionTest in my Server java DomainResolutionTest example.com
but it's ok !
env:
java -version
java version "1.6.0_25"
Java(TM) SE Runtime Environment (build 1.6.0_25-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.0-b11, mixed mode)
os:Red Hat Enterprise Linux Server release 5.7
I am curious why is Inet6AddressImpl,I think it may be Inet4AddressImpl
How to solve it?
What's the cause ?
If it is a dual stack (ipv6 + v4) Java prefers ipv6.
You can force it to prefer ipv4, if your ipv6 is misconfigured somehow.
Set system property with: -Djava.net.preferIPv4Stack=true
soure: http://docs.oracle.com/javase/6/docs/technotes/guides/net/ipv6_guide/
i have had the same exception and solved it by setting my hostname manually in /etc/hosts for the 'localhost' entry both.
127.0.0.1 localhost DL006285-linux
# special IPv6 addresses
::1 localhost ipv6-localhost ipv6-loopback DL006285-linux
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With