赞
踩
在项目中使用到Apache Curator Framework连接Zookeeper 3.4.9服务器,使用的Curator Framework版本是最新版3.2.1
- <dependency>
- <groupId>org.apache.curator</groupId>
- <artifactId>curator-framework</artifactId>
- <version>3.2.1</version>
- </dependency>
项目同时导入了zookeeper-3.5.1的库
结果在使用CuratorFramework.create()方法创建新的节点时,抛出了
- org.apache.zookeeper.KeeperException$UnimplementedException:
- KeeperErrorCode = Unimplemented for [zk节点路径名]
的异常。
Curator Framework的2.x.x版本和3.x.x版本对Zookeeper支持的版本是有差异的,查看Curator Framework的官网(http://curator.apache.org),在Versions部分有这么一段话
- Versions
- The are currently two released versions of Curator, 2.x.x and 3.x.x:
-
- Curator 2.x.x - compatible with both ZooKeeper 3.4.x and ZooKeeper 3.5.x
- Curator 3.x.x - compatible only with ZooKeeper 3.5.x and includes support for new features such as dynamic reconfiguration, etc.
对于zookeeper 3.4.x服务器版本,只有Curator 2.x.x才支持,我使用的是Curator 3.2.1版本,不支持Zookeeper 3.4.9服务器,所以会抛出这个异常, 将Curator Framework的版本改为2.x.x的最后一个版本2.11.1,再运行程序就没有异常了。
- <dependency>
- <groupId>org.apache.curator</groupId>
- <artifactId>curator-framework</artifactId>
- <version>2.11.1</version>
- </dependency>
大家在直接使用Curator Framework进行Zk监控,或者使用Spring Cloud Zookeeper Config时(内含Curator Framework的引用),请注意连接的zookeeper服务器版本,根据zk服务器版本的不同,选择不同的Curator Framework版本
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。