Uploaded image for project: 'Pig'
  1. Pig
  2. PIG-3043

Modify the UrlClassloader in PigContext so that classes from the same classloader are used first instead of the parent

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • None
    • None

    Description

      This behavior would be similar to what application servers do (Tomcat, Jetty, ...) and would allow classes from registered jars to use their own version of a class. It also avoid problems when adding a jar to pig break libraries that make use of dynamic class lookup.

      example of a common pattern that regularly is broken by the current mechanism:
      register lib.jar
      register my.jar
      define blah as my.UDF('my.Implementation')

      my.UDF is in my.jar and uses classes in lib.jar that use Class.forName() to resolve my.Implementation. It works fine until lib.jar is added as a dependency of pig or in the PIG_CLASSPATH. Then classes in lib.jar do not see the classes in registered jars.

      I thinks that overriding loadClass(String name, boolean resolve) would allow doing that.
      We should make an exception for anything in org.apache.pig just like servlet.jar is excluded in app servers.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              julienledem Julien Le Dem
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated: