ERROR org.apache.zookeeper.ClientCnxn:532 - Error while calling watcher

一、背景

使用zookeeper操作时提示这个错误信息

ERROR org.apache.zookeeper.ClientCnxn:532 - Error while calling watcher

  java.lang.NullPointerException
  at org.apache.zookeeper.ClientCnxn$EventThread.processEvent(ClientCnxn.java:530)
  at org.apache.zookeeper.ClientCnxn$EventThread.run(ClientCnxn.java:505)

但是检查zookeeper服务器上实际的操作却是成功了。

二、抛出位置

zk = new ZooKeeper(url, 30000, null);

三、解决方法

zk = new ZooKeeper(url, 30000, new Watcher(){
    @Override
    public void process(WatchedEvent event) {
        // TODO Auto-generated method stub
        logger.debug(" receive event : "+event.getType().name());
}
});

 

    原文作者:一沙世界
    原文地址: https://www.cnblogs.com/yoyotl/p/6593807.html
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞