New Contributor
Posts: 1
Registered: ‎11-24-2015
HBase using Java:SASL authentication failed and Failed to find any Kerberos tgt in secured cluster


Hi all,


I am trying to access HBase using Java API and I am running Java program on my local windows machine. I am using hbase-site.xml also. Connection is getting established for zookeeper and getting kerberos and sasl exception.


configuration config = HBaseConfiguration.create();
config.addResource(new Path(System.getenv("HBASE_CONF_DIR"),"hbase-site.xml"));

UserGroupInformation userGroupInformation = UserGroupInformation.loginUserFromKeytabAndReturnUGI("username", "krb5.keytab");
System.out.println("getLoginUser :: "+UserGroupInformation.getLoginUser());
Admin admin=null;
System.out.println("passed conf");
Connection connection = ConnectionFactory.createConnection(config);
admin = connection.getAdmin();

System.out.println("passed admin");

TableName[] tables = admin.listTableNames();
System.out.println("passed tablename");
for(TableName table: tables){
System.out.println("Table name is");



2015-11-23 22:38:59,650 INFO [main-SendThread(myhostname:2181)] zookeeper.ClientCnxn ( – Opening socket connection to server myhostname/myport. Will not attempt to authenticate using SASL (unknown error)
2015-11-23 22:38:59,708 INFO [main-SendThread(myhostname:2181)] zookeeper.ClientCnxn ( – Socket connection established to myhostname/myport. :2181, initiating session
2015-11-23 22:38:59,779 INFO [main-SendThread(myhostname:2181)] zookeeper.ClientCnxn ( – Session establishment complete on server myhostname/myport:2181, sessionid = 0x150fe9c9404fc98, negotiated timeout = 200000
passed admin —-my debugging statement
2015-11-23 22:39:05,524 WARN [main] ipc.AbstractRpcClient ( – Exception encountered while connecting to the server : GSS initiate failed [Caused by GSSException: No valid credentials provided (Mechanism level: Failed to find any Kerberos tgt)]
2015-11-23 22:39:05,524 FATAL [main] ipc.AbstractRpcClient ( – SASL authentication failed. The most likely cause is missing or invalid credentials. Consider ‘kinit’. GSS initiate failed [Caused by GSSException: No valid credentials provided (Mechanism level: Failed to find any Kerberos tgt)]


Who Me Too'd this topic