forcedotcom / phoenix

BSD 3-Clause "New" or "Revised" License
559 stars 227 forks source link

Query a Secure HBase cluster through Phoenix In Java code #741

Open scootli opened 8 years ago

scootli commented 8 years ago

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

jtaylor-sfdc commented 8 years ago

Hello, This email list is no longer active. Please post your question on our Apache mailing list here: http://phoenix.apache.org/mailing_list.html

On Thu, Jul 30, 2015 at 5:43 AM, scootli notifications@github.com wrote:

Our hadoop and hbase are secure by kerberos. I also see the #382 https://github.com/forcedotcom/phoenix/issues/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 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(); }

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

— Reply to this email directly or view it on GitHub https://github.com/forcedotcom/phoenix/issues/741.

apathodia commented 8 years ago

Hi scootli,

Did you get solution for this?