【踩坑日记】解决org.apache.zookeeper.KeeperException$UnimplementedException: KeeperErrorCode = Unimplemented

使用curator连接zookeeper后,创建节点时,报如下错误:

org.apache.zookeeper.KeeperException$UnimplementedException: KeeperErrorCode = Unimplemented for /blue/app2

	at org.apache.zookeeper.KeeperException.create(KeeperException.java:106)
	at org.apache.zookeeper.KeeperException.create(KeeperException.java:54)
	at org.apache.zookeeper.ZooKeeper.create(ZooKeeper.java:1637)
	at org.apache.curator.framework.imps.CreateBuilderImpl$17.call(CreateBuilderImpl.java:1180)
	at org.apache.curator.framework.imps.CreateBuilderImpl$17.call(CreateBuilderImpl.java:1156)
	at org.apache.curator.connection.StandardConnectionHandlingPolicy.callWithRetry(StandardConnectionHandlingPolicy.java:67)
	at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:81)
	at org.apache.curator.framework.imps.CreateBuilderImpl.pathInForeground(CreateBuilderImpl.java:1153)
	at org.apache.curator.framework.imps.CreateBuilderImpl.protectedPathInForeground(CreateBuilderImpl.java:607)
	at org.apache.curator.framework.imps.CreateBuilderImpl.forPath(CreateBuilderImpl.java:597)
	at org.apache.curator.framework.imps.CreateBuilderImpl.forPath(CreateBuilderImpl.java:575)
	at org.apache.curator.framework.imps.CreateBuilderImpl.forPath(CreateBuilderImpl.java:51)
	at com.blue.curatorTest.testCreate1(curatorTest.java:85)
	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:498)
	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.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
	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.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)

使用环境:

zookeeper版本:zookeeper-3.5.10
cuartor版本:4.3.0

版本不匹配的问题,使用的curator版本过高,使用2.xx就没有问题了。

<!--Curator-->
        <dependency>
            <groupId>org.apache.curator</groupId>
            <artifactId>curator-framework</artifactId>
            <version>2.13.0</version>
        </dependency>

问题解决:
在这里插入图片描述

org.apache.zookeeper.KeeperException$ConnectionLossExceptionZooKeeper客户端库中的一个异常类,表示与ZooKeeper服务器的连接丢失。这个异常通常在以下情况下抛出: 1. 当客户端与ZooKeeper服务器的连接意外断开时,会抛出ConnectionLossException异常。 2. 当客户端尝试与ZooKeeper服务器建立连接时,如果连接失败,也会抛出ConnectionLossException异常。 这个异常类的完整名称是org.apache.zookeeper.KeeperException$ConnectionLossException,它是KeeperException的一个子类。KeeperExceptionZooKeeper客户端库中的一个通用异常类,用于表示与ZooKeeper服务器交互过程中的各种错误。 在处理ConnectionLossException异常时,可以采取以下措施: 1. 检查网络连接:首先,确保客户端与ZooKeeper服务器之间的网络连接是正常的。可以尝试ping ZooKeeper服务器的IP地址,以确保网络连接没有问题。 2. 重试操作:如果连接丢失是由于网络问题导致的,可以尝试重新连接并重试之前的操作。可以使用重试机制来处理ConnectionLossException异常,例如使用循环和延迟重试策略。 3. 检查ZooKeeper服务器状态:如果连接丢失是由于ZooKeeper服务器本身的问题导致的,可以检查ZooKeeper服务器的状态。可以查看ZooKeeper服务器的日志文件,以了解是否有任何错误或异常发生。 4. 调整ZooKeeper客户端配置:有时,连接丢失问题可能是由于ZooKeeper客户端配置不正确导致的。可以检查ZooKeeper客户端的配置文件,确保配置正确。 总之,org.apache.zookeeper.KeeperException$ConnectionLossException表示与ZooKeeper服务器的连接丢失,可以通过检查网络连接、重试操作、检查ZooKeeper服务器状态和调整ZooKeeper客户端配置来处理这个异常。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

陌上人如玉এ

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值