Fix ClassNotFoundException in druid-kerberos extension (#4776)

Class org.apache.hadoop.conf.Configuration inside extensions should be used with caution.
By default, the configuration uses the context class loader of the current thread set to the
class loader used to load the application. Because of isolation between the application and
extensions we must explicitely set the class loader to extension class loader to be able
load classes specified in hadoop configuration file.
This commit is contained in:
Stas Sukhanov 2018-07-28 01:23:09 +02:00 committed by Slim Bouguerra
parent 331a0afb98
commit b0ecfee1ab
1 changed files with 1 additions and 0 deletions

View File

@ -95,6 +95,7 @@ public class DruidKerberosUtil
{
if (!Strings.isNullOrEmpty(internalClientPrincipal) && !Strings.isNullOrEmpty(internalClientKeytab)) {
Configuration conf = new Configuration();
conf.setClassLoader(DruidKerberosModule.class.getClassLoader());
conf.set(CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHENTICATION, "kerberos");
UserGroupInformation.setConfiguration(conf);
try {