Github user sohami commented on a diff in the pull request:
https://github.com/apache/drill/pull/1079#discussion_r159500241
--- Diff:
exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserClient.java ---
@@ -344,7 +344,18 @@ private boolean
clientNeedsAuthExceptPlain(DrillProperties props) {
mechanismName = factory.getSimpleName();
logger.trace("Will try to authenticate to server using {} mechanism
with encryption context {}",
mechanismName, connection.getEncryptionCtxtString());
+
+ // Update the thread context class loader to current class loader
+ // See DRILL-6063 for detailed description
+ final ClassLoader oldThreadCtxtCL =
Thread.currentThread().getContextClassLoader();
+ final ClassLoader newThreadCtxtCL = this.getClass().getClassLoader();
+ Thread.currentThread().setContextClassLoader(newThreadCtxtCL);
+
--- End diff --
This is the only place since this is when `Hadoop Configuration `object is
created inside `createAndLoginUser`. SASL authentication mechanism factories
are scanned before this code itself and moreover they are scanned in context of
current class ClassLoader not in ThreadContext class loader.
---