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

Rohini Palaniswamy commented on PIG-3043:
-----------------------------------------

Asked in case you are attempting to achieve something like that in the backend 
too. That did not seem to be the intention but wanted to confirm. In PIG-3039, 
I put up a patch which gives preference to the registered jars while shipping 
jars to the job. That would conflict in case you were trying something like 
that. 

Just FYI. It is possible to do class loaders at the backend too. Instead of 
archive you can ship the jar as a file without adding to class path and then 
use a URLClassloader to put them in classpath. Have tried that in the past to 
load a different version of Hadoop jar in h20. But anyways with the way 
classpath handling is done in h23(wildcard inclusion of jars) that approach 
will not work.
                
> Modify the UrlClassloader in PigContext so that classes from the same 
> classloader are used first instead of the parent
> ----------------------------------------------------------------------------------------------------------------------
>
>                 Key: PIG-3043
>                 URL: https://issues.apache.org/jira/browse/PIG-3043
>             Project: Pig
>          Issue Type: Improvement
>            Reporter: Julien Le Dem
>
> 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.

--
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

Reply via email to