Apache Curator ZooKeeper - KeeperErrorCode = 未实现,错误

Apache Curator ZooKeeper - KeeperErrorCode = Unimplemented for, error

我使用以下 Apache Curator Maven 依赖项:

    <dependency>
        <groupId>org.apache.curator</groupId>
        <artifactId>curator-x-async</artifactId>
        <version>4.0.1</version>
        <exclusions>
            <exclusion>
                <groupId>org.apache.zookeeper</groupId>
                <artifactId>zookeeper</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

在本地,我已经启动了zookeeper-3.4.13服务器

我尝试使用以下代码创建 EPHEMERAL ZNode:

    int sleepMsBetweenRetries = 100;
    int maxRetries = 3;
    RetryPolicy retryPolicy = new RetryNTimes(maxRetries, sleepMsBetweenRetries);

    CuratorFramework client = CuratorFrameworkFactory.newClient("127.0.0.1:2181", retryPolicy);

    client.start();

    String taskPathZombie = "/tasks/b5957aa6-e250-41e0-a39b-521da61ca937";

    client.create().withMode(CreateMode.EPHEMERAL).forPath(taskPathZombie);

但失败并出现以下异常:

Caused by: org.apache.zookeeper.KeeperException$UnimplementedException: KeeperErrorCode = Unimplemented for /tasks/b5957aa6-e250-41e0-a39b-521da61ca937
    at org.apache.zookeeper.KeeperException.create(KeeperException.java:103) ~[zookeeper-3.5.3-beta.jar:3.5.3-beta-8ce24f9e675cbefffb8f21a47e06b42864475a60]
    at org.apache.zookeeper.KeeperException.create(KeeperException.java:51) ~[zookeeper-3.5.3-beta.jar:3.5.3-beta-8ce24f9e675cbefffb8f21a47e06b42864475a60]
    at org.apache.zookeeper.ZooKeeper.create(ZooKeeper.java:1525) ~[zookeeper-3.5.3-beta.jar:3.5.3-beta-8ce24f9e675cbefffb8f21a47e06b42864475a60]
    at org.apache.curator.framework.imps.CreateBuilderImpl.call(CreateBuilderImpl.java:1181) ~[curator-framework-4.0.1.jar:4.0.1]
    at org.apache.curator.framework.imps.CreateBuilderImpl.call(CreateBuilderImpl.java:1158) ~[curator-framework-4.0.1.jar:4.0.1]
    at org.apache.curator.connection.StandardConnectionHandlingPolicy.callWithRetry(StandardConnectionHandlingPolicy.java:64) ~[curator-client-4.0.1.jar:na]
    at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:100) ~[curator-client-4.0.1.jar:na]
    at org.apache.curator.framework.imps.CreateBuilderImpl.pathInForeground(CreateBuilderImpl.java:1155) ~[curator-framework-4.0.1.jar:4.0.1]
    at org.apache.curator.framework.imps.CreateBuilderImpl.protectedPathInForeground(CreateBuilderImpl.java:605) ~[curator-framework-4.0.1.jar:4.0.1]
    at org.apache.curator.framework.imps.CreateBuilderImpl.forPath(CreateBuilderImpl.java:595) ~[curator-framework-4.0.1.jar:4.0.1]
    at org.apache.curator.framework.imps.CreateBuilderImpl.forPath(CreateBuilderImpl.java:573) ~[curator-framework-4.0.1.jar:4.0.1]
    at org.apache.curator.framework.imps.CreateBuilderImpl.forPath(CreateBuilderImpl.java:49) ~[curator-framework-4.0.1.jar:4.0.1]

我做错了什么以及如何解决?

我使用的 Apache Curator 和 ZooKeeper 组合不正确。现在 Apache Curator 4.0.1ZooKeeper 3.5.4-beta 的组合工作正常

如果 Zookeeper 服务器版本是 3。4.x 那么下面的工作正常。

<dependencies>
    <dependency>
        <groupId>org.apache.zookeeper</groupId>
        <artifactId>zookeeper</artifactId>
        <version>3.4.14</version>
    </dependency>
    <dependency>
        <groupId>org.apache.curator</groupId>
        <artifactId>curator-recipes</artifactId>
        <version>4.2.0</version>
        <exclusions>
            <exclusion>
                <groupId>org.apache.zookeeper</groupId>
                <artifactId>zookeeper</artifactId>
            </exclusion>
        </exclusions>
    </dependency>        
</dependencies>

但是,要使用 Zookeeper 3.5.x 作为客户端(用于节点容器等较新的功能)以及 Curator 4.x、运行 服务器 3.5.x 版本否则客户端抛出 UnimplementedException