>From the code, looks like you were trying to authenticate as user test.
But from the attached log:

bq. getLoginUser :: root (auth:SIMPLE)

FYI

On Thu, Mar 17, 2016 at 8:33 PM, Saurabh Malviya (samalviy) <
samal...@cisco.com> wrote:

>
>
> Hi,
>
>
>
> I am trying to write java code snippet to authenticate hbase using
> Kerberos, But I am getting attached exception. I tried all kind of config
> through code but no luck.
>
>
>
> -Saurabh
>
> ---Java Code
>
>
>
>                 HbaseGetPropertyValues properties = new
> HbaseGetPropertyValues();
>
>                                              properties.getPropValues();
>
>
>
>                                    Configuration hBaseConfig =
> HBaseConfiguration.create();
>
>
>
>                                    hBaseConfig.setInt("timeout",
> Integer.parseInt(properties.TIMEOUT));
>
>
> hBaseConfig.set("hbase.zookeeper.quorum",
> properties.HBASE_ZOOKEEPER_QUORUM);
>
>                                    //hBaseConfig.set("hbase.master",
> "hdfs-hbase-m1.insight-test-1:60000");
>
>
> hBaseConfig.set("hbase.zookeeper.property.clientport",
> properties.HBASE_ZOOKEEPER_PROPERTY_CLIENTPORT);
>
>
> hBaseConfig.set("zookeeper.znode.parent",
> properties.ZOOKEEPER_ZNODE_PARENT);
>
>
>
>
>     //hBaseConfig.set("hadoop.security.authentication", "kerberos");
>
>
> hBaseConfig.set("hbase.security.authentication", "kerberos");
>
>
>
>
>      hBaseConfig.set("hbase.master.kerberos.principal",
> "test/INSIGHT@INSIGHT");
>
>
> hBaseConfig.set("hbase.regionserver.kerberos.principal",
> "test/INSIGHT@INSIGHT");
>
>
> hBaseConfig.set("hbase.master.keytab.file", "/root/test.keytab");
>
>
> hBaseConfig.set("hbase.regionserver.keytab.file", "/root/test.keytab");
>
>
>
>                                    //runLoginAndRenewalThread(hBaseConfig,
> "/root/test.keytab", "test/INSIGHT@INSIGHT");
>
>
>
>
> UserGroupInformation.setConfiguration(hBaseConfig);
>
>
> User.login(hBaseConfig,"hbase.master.keytab.file",
> "hbase.regionserver.kerberos.principal", null);
>
>
> //UserGroupInformation.loginUserFromKeytab("test/INSIGHT@INSIGHT
> ","/root/test.keytab");
>
>                                    UserGroupInformation ugi =
> UserGroupInformation.loginUserFromKeytabAndReturnUGI("test/INSIGHT@INSIGHT
> ","/root/samalviy.keytab");
>
>                                    UserGroupInformation.setLoginUser(ugi);
>
>
>
>                                    System.out.println("getLoginUser ::
> "+ugi.getLoginUser());
>
>                                    System.out.println(hBaseConfig);
>
>
>
>
> HBaseAdmin.checkHBaseAvailable(hBaseConfig);
>
>                                    Connection connection =
> ConnectionFactory.createConnection(hBaseConfig);
>

Reply via email to