Zookeeper与Curator开发遇到的坑

做zookeeper clinet客户端开发,zookeeper使用如下版本: 3.4.5-cdh5.15.1, curator-recipes使用3.3.0.,会报如下错误

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/curator/connection/ConnectionHandlingPolicy
	at org.apache.curator.framework.CuratorFrameworkFactory.builder(CuratorFrameworkFactory.java:77)
	at org.apache.curator.framework.CuratorFrameworkFactory.newClient(CuratorFrameworkFactory.java:103)
	at org.apache.curator.framework.CuratorFrameworkFactory.newClient(CuratorFrameworkFactory.java:89)
	at com.wxx.bigdata.zookeepper.curator.CuratorClient.main(CuratorClient.java:14)
Caused by: java.lang.ClassNotFoundException: org.apache.curator.connection.ConnectionHandlingPolicy
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 4 more

经过了解,Curator的版本和zookeeper的版本有对应关系。Curator2.X的吧,对于Curator2.X是支持Zookeeper3.4.X的,所以如果目前你是Zookeeper3.4.X的版本,还是使用Curator2.X的吧,比如:2.7.0
 

你可能感兴趣的:(大数据,zookeeper)