title: MapReduce job can't talk with Hbase on a Kerberos enabled CDH cluster
body: <p>I am writing a MapReduce application to access Hbase data on a CDH cluster with Kerberos enabled. My CDH version is 5.9.0, running on 3 nodes and Kerberos version is 1.10.1. Now, I face an issue and hope someone can help. </p>
  
  <p>My code: </p>
  
  <pre><code>conf.set("hadoop.security.authentication", "Kerberos");
  UserGroupInformation.setConfiguration(conf);
  UserGroupInformation.loginUserFromKeytab("jj@example.com", "jj.keytab");
  
  HTable table = new HTable(conf, "myTable");
   Put p = new Put(Bytes.toBytes("myLittleRow"));
   p.add(Bytes.toBytes("myColumnFamily"), Bytes.toBytes("someQualifier"),
           Bytes.toBytes("Some Value"));
   table.put(p);
  </code></pre>
  
  <p>The above code help me to run in <strong>local mode successfully</strong> with <code>java -jar</code> or <code>hadoop -jar</code>. But when I try to run with a <strong>Oozie Workflow via Hue</strong>, the following issue happen: </p>
  
  <pre><code>FATAL [main] org.apache.hadoop.hbase.ipc.RpcClientImpl: SASL authentication failed. The most likely cause is missing or invalid credentials. Consider 'kinit'. javax.security.sasl.SaslException: GSS initiate failed [Caused by GSSException: No valid credentials provided (Mechanism level: Failed to find any Kerberos tgt)]
  Caused by: GSSException: No valid credentials provided (Mechanism level: Failed to find any Kerberos tgt)
  </code></pre>
  
  <p>So, I try to use init credentials to obtain valid token to run the job via</p>
  
  <pre><code>TableMapReduceUtil.initCredentialsForCluster(job,conf);
  </code></pre>
  
  <p>but the issue still happen. Do someone have any idea? </p>