Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-9424

The "hadoop jar" invocation should include the passed jar on the classpath as a whole

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Reopened
    • Minor
    • Resolution: Unresolved
    • 2.0.3-alpha
    • None
    • util
    • None

    Description

      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.

      Attachments

        1. HADOOP-9424.patch
          0.8 kB
          Harsh J

        Activity

          People

            Unassigned Unassigned
            qwertymaniac Harsh J
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated: