If your zookeeper cluster is ok, maybe you sessionTimeout is too small, pelease increase the sessionTimeout, eg: ZooKeeper zk = new ZooKeeper(connectString, 12000, defaultWatcher); Thanks Joe Zou
-----Original Message----- From: Isaac [mailto:[email protected]] Sent: Wednesday, September 07, 2011 15:49 To: [email protected] Subject: Re: zookeeper connection loss exception occurs on new created ZooKeeper instance too much,why? oh, i found this, operate on a zookeeper in status CONNECTING will throw a ConnectionLossException. maybe that's the problem. example: [zk: 172.27.1.1:8082(CONNECTING) 1] ls / Exception in thread "main" org.apache.zookeeper.KeeperException$ ConnectionLossException: KeeperErrorCode = ConnectionLoss for / at org.apache.zookeeper.KeeperException.create(KeeperException.java:90) at org.apache.zookeeper.KeeperException.create(KeeperException.java:42) at org.apache.zookeeper.ZooKeeper.getChildren(ZooKeeper.java:1243) at org.apache.zookeeper.ZooKeeper.getChildren(ZooKeeper.java:1271) at org.apache.zookeeper.ZooKeeperMain.processZKCmd(ZooKeeperMain.java:700) at org.apache.zookeeper.ZooKeeperMain.processCmd(ZooKeeperMain.java:581) at org.apache.zookeeper.ZooKeeperMain.executeLine(ZooKeeperMain.java:353) at org.apache.zookeeper.ZooKeeperMain.run(ZooKeeperMain.java:311) at org.apache.zookeeper.ZooKeeperMain.main(ZooKeeperMain.java:270) On Wed, Sep 7, 2011 at 3:32 PM, Isaac <[email protected]> wrote: > zookeeper connection loss exception occurs on new created ZooKeeper > instance too much > > code like this: > ZooKeeper zk = new ZooKeeper(connectString, 3000, defaultWatcher); > zk.exists("/"); //connection loss exception occurs here sometimes. > > any one knows why? > > >
