fapifta opened a new pull request #2965:
URL: https://github.com/apache/hadoop/pull/2965


   As stated in this article:
   
https://www.infoworld.com/article/2077344/find-a-way-out-of-the-classloader-maze.html
   
   A native thread has its context classloader set to null by default.
   If the context classloader which is used internally by JNDI to load a class 
is
   null, then the bootstrap classloader is used, according to the apidoc here:
   
https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html#forName-java.lang.String-boolean-java.lang.ClassLoader-
   
   JNDI uses this form with the context classloader as can be seen here:
   
https://github.com/openjdk/jdk11u/blob/master/src/java.naming/share/classes/com/sun/jndi/ldap/VersionHelper.java#L107
   or here:
   
https://github.com/openjdk/jdk8u/blob/master/jdk/src/share/classes/com/sun/jndi/ldap/VersionHelper12.java#L72
   
   In Impala this call happens from a Thread created in native space, so in that
   case, the System/Application classloader loads LdapSslSocketFactory fine in
   LdapGroupsMapping.getDirContext() while creating the environment, but then
   InitialDirContext constructor gets to instantiation the LdapSslSocketFactory
   inside JNDI with the help of the linked VersionHelper impelmentations,
   and fails to load the class with the bootstrap classloader as context
   classloader is null.
   
   In order to solve this problem, we can safely use the classloader of the
   LdapGroupsMapping class, as it had to load the LdapSslSocketFactory class
   before.
   
   ## NOTICE
   
   Please create an issue in ASF JIRA before opening a pull request,
   and you need to set the title of the pull request which starts with
   the corresponding JIRA issue number. (e.g. HADOOP-XXXXX. Fix a typo in YYY.)
   For more details, please see 
https://cwiki.apache.org/confluence/display/HADOOP/How+To+Contribute
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to