我在/ etc / hosts文件中有记录,其中包含host-name.com
的IPv4和IPv6地址
但我有时会UnknownHostException
喜欢:
redis.clients.jedis.exceptions.JedisConnectionException: java.net.UnknownHostException: host-name.com
at redis.clients.jedis.Connection.connect(Connection.java:137)
at redis.clients.jedis.BinaryClient.connect(BinaryClient.java:65)
at redis.clients.jedis.BinaryJedis.connect(BinaryJedis.java:1706)
at redis.clients.jedis.JedisFactory.makeObject(JedisFactory.java:28)
at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1188)
at redis.clients.util.Pool.getResource(Pool.java:38)
... 2 common frames omitted
Caused by: java.net.UnknownHostException: host-name.com
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:178)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:579)
at redis.clients.jedis.Connection.connect(Connection.java:132)
... 7 common frames omitted
它是如何可能的,我该如何解决?
-Djava.net.preferIPv4Stack=true
hosts: files dns
-rw-r--r--