diff --git a/yarn/src/main/scala/org/apache/spark/deploy/yarn/Client.scala b/yarn/src/main/scala/org/apache/spark/deploy/yarn/Client.scala index 4ac3397f1ad2851c0883a1f1b34dc62a1bf1e22f..fc11bbf97e2ecdc0637b7aece0f25a2aa3d58a91 100644 --- a/yarn/src/main/scala/org/apache/spark/deploy/yarn/Client.scala +++ b/yarn/src/main/scala/org/apache/spark/deploy/yarn/Client.scala @@ -1295,11 +1295,12 @@ object Client extends Logging { logDebug("Attempting to fetch HBase security token.") - val hbaseConf = confCreate.invoke(null, conf) - val token = obtainToken.invoke(null, hbaseConf).asInstanceOf[Token[TokenIdentifier]] - credentials.addToken(token.getService, token) - - logInfo("Added HBase security token to credentials.") + val hbaseConf = confCreate.invoke(null, conf).asInstanceOf[Configuration] + if ("kerberos" == hbaseConf.get("hbase.security.authentication")) { + val token = obtainToken.invoke(null, hbaseConf).asInstanceOf[Token[TokenIdentifier]] + credentials.addToken(token.getService, token) + logInfo("Added HBase security token to credentials.") + } } catch { case e: java.lang.NoSuchMethodException => logInfo("HBase Method not found: " + e)