在zookeeper中生产者消费者队列

时间:2014-06-01 23:00:56

标签: java exception hadoop apache-zookeeper znodes

我是zookeeper编程的新手。我正在尝试使用zookeeper实现生产消费者队列。我在初始化队列时遇到异常。在我的zookeeper中,只有root entry是[zookeeper]。

我正在尝试执行给出的代码。    http://zookeeper.apache.org/doc/r3.3.3/zookeeperTutorial.html#sc_producerConsumerQueues(此处不粘贴代码以保持帖子清洁)

例外:

org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /app1
at org.apache.zookeeper.KeeperException.create(KeeperException.java:111)
at org.apache.zookeeper.KeeperException.create(KeeperException.java:51)
at org.apache.zookeeper.ZooKeeper.create(ZooKeeper.java:783)
at Queue.<init>(Queue.java:27)
at Queue.main(Queue.java:90)

Can any one advice me on  this?


Thanks

1 个答案:

答案 0 :(得分:0)

当父节点(&#34; / root&#34;)不存在而未创建时,您尝试创建子节点(例如&#34; / root / child&#34;)。检查是否已创建父节点。