zookeeper.KeeperException$UnimplementedException: KeeperErrorCode = Unimplemented for {root.path}
1 异常结果
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | org.apache.zookeeper.KeeperException$UnimplementedException: KeeperErrorCode = Unimplemented for /curator at org.apache.zookeeper.KeeperException.create(KeeperException.java: 103 ) at org.apache.zookeeper.KeeperException.create(KeeperException.java: 51 ) at org.apache.zookeeper.ZooKeeper.create(ZooKeeper.java: 1525 ) at org.apache.curator.framework.imps.CreateBuilderImpl$ 17 .call(CreateBuilderImpl.java: 1189 ) at org.apache.curator.framework.imps.CreateBuilderImpl$ 17 .call(CreateBuilderImpl.java: 1166 ) at org.apache.curator.connection.StandardConnectionHandlingPolicy.callWithRetry(StandardConnectionHandlingPolicy.java: 64 ) at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java: 100 ) at org.apache.curator.framework.imps.CreateBuilderImpl.pathInForeground(CreateBuilderImpl.java: 1163 ) at org.apache.curator.framework.imps.CreateBuilderImpl.protectedPathInForeground(CreateBuilderImpl.java: 603 ) at org.apache.curator.framework.imps.CreateBuilderImpl.forPath(CreateBuilderImpl.java: 593 ) at org.apache.curator.framework.imps.CreateBuilderImpl.forPath(CreateBuilderImpl.java: 47 ) at cn.practice.zk.ZookeeperClientPractice.test(ZookeeperClientPractice.java: 41 ) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java: 62 ) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java: 43 ) at java.lang.reflect.Method.invoke(Method.java: 497 ) at org.junit.runners.model.FrameworkMethod$ 1 .runReflectiveCall(FrameworkMethod.java: 50 ) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java: 12 ) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java: 47 ) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java: 17 ) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java: 325 ) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java: 78 ) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java: 57 ) at org.junit.runners.ParentRunner$ 3 .run(ParentRunner.java: 290 ) at org.junit.runners.ParentRunner$ 1 .schedule(ParentRunner.java: 71 ) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java: 288 ) at org.junit.runners.ParentRunner.access$ 000 (ParentRunner.java: 58 ) at org.junit.runners.ParentRunner$ 2 .evaluate(ParentRunner.java: 268 ) at org.junit.runners.ParentRunner.run(ParentRunner.java: 363 ) at org.junit.runner.JUnitCore.run(JUnitCore.java: 137 ) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java: 68 ) at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java: 47 ) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java: 242 ) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java: 70 ) |
2 原因是Zookeeper的版本与curator的版本不匹配造成的
自己查阅了一下资料发现匹配规则如下
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | curator作为zookeeper的客户端,并不是最新版的就没问题,因为它的版本和zookeeper的版本有对应关系。 ZooKeeper 3.5 .x Curator4. 0 十分依赖Zookeeper3. 5 .X ZooKeeper 3.4 .x Curator4. 0 在软兼容模式下支持Zookeeper3. 4 .X,但是需要依赖排除zookeeper 复制代码 <dependency> <groupId>org.apache.curator</groupId> <artifactId>curator-recipes</artifactId> <version>${curator-version}</version> <exclusions> <exclusion> <groupId>org.apache.zookeeper</groupId> <artifactId>zookeeper</artifactId> </exclusion> </exclusions> </dependency> 复制代码 同时必须加入Zookeeper3. 4 .X的依赖,并且呢,因为是软兼容模式,一些 3.4 .X不具备的新特性是不能使用的。 低版本 对于Curator2.X是支持Zookeeper3. 4 .X的,所以如果目前你是Zookeeper3. 4 .X的版本,还是使用Curator2.X的吧, |
3 解决方案,因为我的部署Zookeeper版本为3.4.5所以应该选择2.x的curator版本
1 2 3 4 5 6 7 8 9 10 11 | <dependency> <groupId>org.apache.curator</groupId> <artifactId>curator-client</artifactId> <version> 2.12 . 0 </version> </dependency> <dependency> <groupId>org.apache.curator</groupId> <artifactId>curator-framework</artifactId> <version> 2.12 . 0 </version> </dependency> |
重新maven导入一下jar包解决问题,之前已经创建成功过了,所以抛出节点已经存在的错误
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 一个奇形怪状的面试题:Bean中的CHM要不要加volatile?
· [.NET]调用本地 Deepseek 模型
· Blazor Hybrid适配到HarmonyOS系统
· Obsidian + DeepSeek:免费 AI 助力你的知识管理,让你的笔记飞起来!
· 解决跨域问题的这6种方案,真香!
· 一套基于 Material Design 规范实现的 Blazor 和 Razor 通用组件库
· 分享4款.NET开源、免费、实用的商城系统