dubbo连接zookeeper报错:
org.apache.zookeeper.ClientCnxn : Session 0x0 for server 127.0.0.1/<unresolved>:2181, unexpected error, closing socket connection and attempting reconnect
java.lang.IllegalArgumentException: Unable to canonicalize address 127.0.0.1/<unresolved>:2181 because it's not resolvable
问题原因:
Zookeeper对象实例化时,会调用InetSocketAddress的toString方法;而在jdk17中,该方法解析空字符串会拼装/<unresolved>
解决方法:
1、更换jdk17为jdk8;
2、升级本机引入的zookeeper依赖,例如3.9.1版本
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
<version>3.9.1</version>
</dependency>
版权归原作者 蔡文龙. 所有, 如有侵权,请联系我们删除。