Support Questions
Find answers, ask questions, and share your expertise
Announcements
Check out our newest addition to the community, the Cloudera Innovation Accelerator group hub.

hive udf with hbase connection on a secure cluster

Rising Star

I am trying to write a hive udf which connects to hbase table. But, the program is failing to access due to security exception and throwing below:

javax.security.auth.login.LoginException: Unable to obtain password from user at

Below is the code i am trying ...

config = HBaseConfiguration.create();

        config.set("hadoop.security.authentication", "Kerberos");
        config.set("hbase.security.authentication", "kerberos");

        config.addResource("src/main/resources/hbase-site.xml");

        // Point to the krb5.conf file.
        System.setProperty("java.security.krb5.conf", "src/main/resources/krb5.conf");
        System.setProperty("sun.security.krb5.debug", "true");
        UserGroupInformation.setConfiguration(config);
        UserGroupInformation.loginUserFromKeytab("pricipal", "keytab");

        connection = ConnectionFactory.createConnection(config);

can someone please share ur thoughts and help me fix the issue ....

1 REPLY 1

Super Mentor

@Raja A

Can you please check if you are using the correct keytab? And able to do "kinit" to get the ticket?

In your code i do not see that you are passing the keytab path anywhere. May be you can look at the following example that gives an example of the same: https://github.com/jjmeyer0/hdp-test-examples/blob/master/src/main/java/com/jj/hbase/HBaseClient.jav...

.

And

https://community.hortonworks.com/articles/48831/connecting-to-hbase-in-a-kerberos-enabled-cluster.h...