[
https://issues.apache.org/jira/browse/HADOOP-15639?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16597575#comment-16597575
]
Qinghui Xu commented on HADOOP-15639:
-------------------------------------
Here is a patch to fix it:
https://github.com/criteo-forks/hadoop-common/pull/87/commits/da6fdfa53410906068383550b6214b7a81344083
> Classloader issue with hadoop cmd -libjars option
> --------------------------------------------------
>
> Key: HADOOP-15639
> URL: https://issues.apache.org/jira/browse/HADOOP-15639
> Project: Hadoop Common
> Issue Type: Bug
> Reporter: Qinghui Xu
> Priority: Major
>
> '-libjars' option gives the possibility to add extra libraries in a hadoop
> command by providing a custom URLClassLoader to fetch jars regarding to the
> option.
> The classloader is provided to both hadoop Configuration and the main
> thread's context classloader, so that when calling Configuration#getClass or
> using Class.forName the class can be loaded by the URLClassLoader.
> But two instances of URLClassLoader are provided to Configuration and to
> thread context classloader respectively, which makes a same class possible to
> be loaded twice by two classloaders. And class loaded by different
> classloaders is considered different.
> So the following assertion will fail:
> {code:java}
> // CustomFileSystem is provided by -libjars option
> Class<?> clazz1 = conf.getClass("CustomFileSystem");
> Class<?> clazz2 = Class.forName("CustomFileSystem");
> // The two classes are different
> assert clazz1 == clazz2{code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]