This repository was archived by the owner on Feb 12, 2022. It is now read-only.

Description
Our hadoop and hbase are secure by kerberos. I also see the #382. and The sqlline works(our version is phoenix-4.5.0-HBase-0.98-bin). My current problem is how I do in java code?
My current code are as following:
Connection cc = null;
Statement statement = null;
String rootPath = System.getProperty("user.dir");
System.setProperty("java.security.auth.login.config", rootPath + "/conf/zk-jaas.conf");
String driver = "org.apache.phoenix.jdbc.PhoenixDriver";
String url = "jdbc:phoenix:" + zkServer + ":" + zkPort;
try {
Class.forName(driver);
cc = DriverManager.getConnection(url);
statement = cc.createStatement();
} catch (Exception ex) {
ex.printStackTrace();
}
and the hbase-site.xml is in the classpath.
But I got the error as follows on hbase master:
[RpcServer.reader=4,port=60000] ipc.RpcServer: RpcServer.listener,port=60000: count of bytes read: 0
org.apache.hadoop.hbase.security.AccessDeniedException: Authentication is required
at org.apache.hadoop.hbase.ipc.RpcServer$Connection.readAndProcess(RpcServer.java:1513)
at org.apache.hadoop.hbase.ipc.RpcServer$Listener.doRead(RpcServer.java:854)
at org.apache.hadoop.hbase.ipc.RpcServer$Listener$Reader.doRunLoop(RpcServer.java:645)
at org.apache.hadoop.hbase.ipc.RpcServer$Listener$Reader.run(RpcServer.java:620)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
How I can do with secure hbase in java code? Thanks.
It will be great if some one could share their thoughts