I have created a zookeeper client:
final ZooKeeper zk = new ZooKeeper("127.0.0.1", Ints.checkedCast(zkSessionTimeoutMs), new Watcher() {
@Override
public void process(WatchedEvent event) {
if (event.getState() == Event.KeeperState.SyncConnected) {
connected.countDown();
}
}
});
Followed by setting auth info:
zk.addAuthInfo("digest", "username:password".getBytes());
Now when I am making a call to get the ACL:
zk.getACL("/protected/path", stat)
This call is failing with:
Exception in thread "main" org.apache.zookeeper.KeeperException$NoAuthException: KeeperErrorCode = NoAuth for /protected/path
at org.apache.zookeeper.KeeperException.create(KeeperException.java:113)
at org.apache.zookeeper.KeeperException.create(KeeperException.java:51)
at org.apache.zookeeper.ZooKeeper.getACL(ZooKeeper.java:1330)
What am I missing here? I am already setting the username and password using addAuthInfo()
Library used:
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
<version>3.4.6</version>
</dependency>