1
我正在使AuthenticationProvider
在認證過程中連接到Zookeeper(與它運行的是相同的)並檢查節點中該用戶是否給出了正確的密碼。通過Zookeeper中的AuthenticationProvider建立與Zookeeper的連接
基本上流看起來水木清華這樣的:
@Override
public KeeperException.Code handleAuthentication(ServerCnxn cnxn, byte[] authData) {
final String usernameColonPassword = new String(authData);
String[] split = usernameColonPassword.split(":");
final String username = split[0];
final String password = split[1];
byte[] binary = curator.getData().forPath(ATUH_NODE); // here error is thrown
// check is password is correct
}
的問題是,所有的時間,我在行時館長獲取數據變得KeeperErrorCode = ConnectionLoss
。這種行爲的原因是什麼?在身份驗證過程中,我不允許連接到授權客戶端的Zookeeper?
下面全堆棧跟蹤:
org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for XXX
at org.apache.zookeeper.KeeperException.create(KeeperException.java:99)
at org.apache.zookeeper.KeeperException.create(KeeperException.java:51)
at org.apache.zookeeper.ZooKeeper.exists(ZooKeeper.java:1045)
at org.apache.curator.framework.imps.ExistsBuilderImpl$2.call(ExistsBuilderImpl.java:172)
at org.apache.curator.framework.imps.ExistsBuilderImpl$2.call(ExistsBuilderImpl.java:161)
at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:107)
at org.apache.curator.framework.imps.ExistsBuilderImpl.pathInForeground(ExistsBuilderImpl.java:157)
at org.apache.curator.framework.imps.ExistsBuilderImpl.forPath(ExistsBuilderImpl.java:148)
at org.apache.curator.framework.imps.ExistsBuilderImpl.forPath(ExistsBuilderImpl.java:36)