Apache Curator Unimplemented Errors When Trying to Create zNodes

I had the same problem.

I tried to use inTransaction () as explained here: http://www.programcreek.com/java-api-examples/index.php?api=org.apache.curator.framework.CuratorFramework on exercise 6 and seems to work.

client.inTransaction ().create().forPath("/larry-smells/foop", "tuna?".getBytes()).and ().commit ();

I also faced a similar exception, I used the below dependencies which are compatible and helps me to resolve the exception.

    <dependency>
        <groupId>org.apache.zookeeper</groupId>
        <artifactId>zookeeper</artifactId>
        <version>3.4.6</version>
    </dependency>

    <dependency>
        <groupId>org.apache.curator</groupId>
        <artifactId>curator-framework</artifactId>
        <version>4.0.1</version>
    </dependency>

    <dependency>
        <groupId>org.apache.curator</groupId>
        <artifactId>curator-x-discovery</artifactId>
        <version>4.0.1</version>
    </dependency>


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());
            }

    }
}