title: Kerberos java to hive keytab authentication, login failure UserGroupInformation.loginUserFromKeytab
body: <p>I am trying to get kerberos keytab authentication work from java to Hive and not finding solution to fix the issue.</p>
  
  <pre><code>    org.apache.hadoop.conf.Configuration conf = new   
         org.apache.hadoop.conf.Configuration();
      conf.set("hadoop.security.authentication", "kerberos");
      conf.set(HiveClientFactory.HIVE_METASTORE_URIS,"thrift://{URL}");
      UserGroupInformation.setConfiguration(conf);
      UserGroupInformation.loginUserFromKeytab(krbPrincipal, keyTabPath);
  </code></pre>
  
  <blockquote>
    <p>java.io.IOException: Login failure for {krbPrincipal} from keytab
    {keyTabPath}  at
    org.apache.hadoop.security.UserGroupInformation.loginUserFromKeytab(UserGroupInformation.java:855)</p>
    
    <p>Caused by: javax.security.auth.login.LoginException: Unable to obtain
    password from user</p>
    
    <p>at
    com.sun.security.auth.module.Krb5LoginModule.promptForPass(Krb5LoginModule.java:789)
      at
    com.sun.security.auth.module.Krb5LoginModule.attemptAuthentication(Krb5LoginModule.java:654)</p>
  </blockquote>
  
  <p>I would really appreciate some insight to help resolve this.</p>