Qinghui Xu created HADOOP-15639: ----------------------------------- Summary: 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
'-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: common-dev-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-dev-h...@hadoop.apache.org