Skip to content

When using Apache Curator, why does creating a zNode cause NoNodeException

I am trying to create a “directory” in Zookeeper like this:

curatorFramework = CuratorFrameworkFactory.newClient(
    new RetryNTimes(zkInfo.getRetryAttempts(), 

byte[] byteArray = new byte[1];
byteArray[0] = (byte) 7;

    .forPath("/my_node", byteArray); 

Perplexingly, it is giving me a “NoNodeException” on the very node I’m trying to create.

Caused by: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /my_node
        at org.apache.zookeeper.KeeperException.create( ~[stormjar.jar:?]
        at org.apache.zookeeper.KeeperException.create( ~[stormjar.jar:?]
        at org.apache.zookeeper.ZooKeeper.create( ~[stormjar.jar:?]
        at org.apache.curator.framework.imps.CreateBuilderImpl$ ~[stormjar.jar:?]
        at org.apache.curator.framework.imps.CreateBuilderImpl$ ~[stormjar.jar:?]
        at org.apache.curator.connection.StandardConnectionHandlingPolicy.callWithRetry( ~[stormjar.jar:?]
        at org.apache.curator.RetryLoop.callWithRetry( ~[stormjar.jar:?]
        at org.apache.curator.framework.imps.CreateBuilderImpl.pathInForeground( ~[stormjar.jar:?]
        at org.apache.curator.framework.imps.CreateBuilderImpl.protectedPathInForeground( ~[stormjar.jar:?]
        at org.apache.curator.framework.imps.CreateBuilderImpl.forPath( ~[stormjar.jar:?]
        at org.apache.curator.framework.imps.CreateBuilderImpl$3.forPath( ~[stormjar.jar:?]
        at org.apache.curator.framework.imps.CreateBuilderImpl$3.forPath( ~[stormjar.jar:?]

Note that I am able to connect to Zookeeper:

Socket connection established to, initiating session
Session establishment complete on server, sessionid = 0x100000363b13354, negotiated timeout = 20000        

Please note that the Zookeeper server is on a remote machine and the ip (“”) has been changed in this post.


Seems related to ACLs, just to be sure, you could manually create it.

Locate your local zk binaries (doesn’t need to be on the remote host) and launch the client (zkCli) pointing at your server. Once connected, create the new znode:

bin/ -server

[zkshell:x] create /my_node
>>Created /mynode

The shell should output the last sentence in order to guarantee the node has been created. Once done, launch again the Curator process.

Take a look here for more detailed info about the zk client.