Apache Curator Unimplemented Errors When Trying to Create zNodes

snerd picture snerd · Mar 1, 2016 · Viewed 9.7k times · Source

I'm attempting to use Apache Curator with a dockerized zookeeper instance and no matter how I attempt to connect I always end up with a

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

error. I've tried making sense of the documentation but I'm not getting anywhere. I've logged into the zookeeper CLI and ensured the port number is correct thusly:

snerd@powerglove:~$ docker ps CONTAINER ID        IMAGE               COMMAND                CREATED             STATUS              PORTS   NAMES 31f1093495ba        compose_zookeeper   "/opt/zookeeper/bin/   3 weeks ago         Up About a minute   0.0.0.0:32770->2181/tcp,
0.0.0.0:32769->2888/tcp, 0.0.0.0:32768->3888/tcp   zookeeper

here is the code I'm trying to use:

public class App {
    public static void main( String[] args ) {
        CuratorFramework client = CuratorFrameworkFactory.newClient("0.0.0.0:32770", new RetryUntilElapsed(3000, 1000));
        client.start();

            try {
                client.create().forPath("/larry-smells/foop", "tuna?".getBytes());
            } catch (Exception e) {
                System.out.println(e.toString());
            }

    }
}

As far as I can tell from the Curator getting started page, this should work. What am I missing?

edit1 just figured out that I'm able to pull data out of the zookeeper ensemble thusly:

System.out.println(new String(curatorFramework.getData().forPath("/larry-smells"))); 

but the create command is still blowing up.

edit2

stacktrace of the error:

org.apache.zookeeper.KeeperException$UnimplementedException: KeeperErrorCode = Unimplemented for /larry-smells/foop 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:1297) at org.apache.curator.framework.imps.CreateBuilderImpl$17.call(CreateBuilderImpl.java:1040) at org.apache.curator.framework.imps.CreateBuilderImpl$17.call(CreateBuilderImpl.java:1023) at org.apache.curator.connection.StandardConnectionHandlingPolicy.callWithRetry(StandardConnectionHandlingPolicy.java:67) at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:99) at org.apache.curator.framework.imps.CreateBuilderImpl.pathInForeground(CreateBuilderImpl.java:1020) at org.apache.curator.framework.imps.CreateBuilderImpl.protectedPathInForeground(CreateBuilderImpl.java:501) at org.apache.curator.framework.imps.CreateBuilderImpl.forPath(CreateBuilderImpl.java:491) at org.apache.curator.framework.imps.CreateBuilderImpl$4.forPath(CreateBuilderImpl.java:367) at org.apache.curator.framework.imps.CreateBuilderImpl$4.forPath(CreateBuilderImpl.java:309) at com.mycompany.app.App.main(App.java:35)

Answer

Petter picture Petter · Mar 2, 2016

Edit: Apparently this error can occur if you're using the wrong combination of Curator in combination with Zookeeper. From curator.apache.org :

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.


It's hard to pinpoint your problem with only that error-code and not a stack trace, but some improvements I would suggest to make your application more stable is:

public class App {
    public static void main( String[] args ) {
        CuratorFramework client = CuratorFrameworkFactory.newClient("0.0.0.0:32770", new RetryUntilElapsed(3000, 1000));
        client.start();

        try {
            //make sure you're connected to zookeeper.
            client.blockUntilConnected();

            //Make sure the parents are created.
            client.create().creatingParentsIfNeeded().forPath("/larry-smells/foop", "tuna?".getBytes());
        } catch (Exception e) {
            System.out.println(e.toString());
            }

    }
}