You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "Harsh J (JIRA)" <ji...@apache.org> on 2013/07/18 04:28:49 UTC

[jira] [Commented] (HADOOP-9424) The "hadoop jar" invocation should include the passed jar on the classpath as a whole

    [ https://issues.apache.org/jira/browse/HADOOP-9424?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13711948#comment-13711948 ] 

Harsh J commented on HADOOP-9424:
---------------------------------

The workaround is sufficient, but seems unnecessary and unintuitive to users to automatically perform. That is, they wouldn't realize this is what's hitting them immediately.

The lib/ point is a good one; that may be expected as well if we're doing this. But just for starters we could add the jar at least onto the classpath?
                
> The "hadoop jar" invocation should include the passed jar on the classpath as a whole
> -------------------------------------------------------------------------------------
>
>                 Key: HADOOP-9424
>                 URL: https://issues.apache.org/jira/browse/HADOOP-9424
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: util
>    Affects Versions: 2.0.3-alpha
>            Reporter: Harsh J
>            Assignee: Harsh J
>            Priority: Minor
>         Attachments: HADOOP-9424.patch
>
>
> When you have a case such as this:
> {{X.jar -> Classes = Main, Foo}}
> {{Y.jar -> Classes = Bar}}
> With implementation details such as:
> * Main references Bar and invokes a public, static method on it.
> * Bar does a class lookup to find Foo (Class.forName("Foo")).
> Then when you do a {{HADOOP_CLASSPATH=Y.jar hadoop jar X.jar Main}}, the Bar's method fails with a ClassNotFound exception cause of the way RunJar runs.
> RunJar extracts the passed jar and includes its contents on the ClassLoader of its current thread but the {{Class.forName(…)}} call from another class does not check that class loader and hence cannot find the class as its not on any classpath it is aware of.
> The script of "hadoop jar" should ideally include the passed jar argument to the CLASSPATH before RunJar is invoked, for this above case to pass.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira