diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/util/CoprocessorClassLoader.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/util/CoprocessorClassLoader.java index a3aabf7..144d129 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/util/CoprocessorClassLoader.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/util/CoprocessorClassLoader.java @@ -115,6 +115,17 @@ public class CoprocessorClassLoader extends ClassLoaderBase { }; /** + * If the class being loaded starts with any of these strings, we will load it from the + * coprocessor jar to avoid wrongly exempting/skipping it in the coprocessor jar + * e.g. org.apache.hadoop.hive could be wrongly exempted because it starts with + * org.apache.hadoop as specified in CLASS_PREFIX_EXEMPTIONS. + * + */ + private static final String[] CLASS_PREFIX_NO_EXEMPTION = new String[] { + "org.apache.hadoop.hive" + }; + + /** * If the resource being loaded matches any of these patterns, we will first * attempt to load the resource with the parent ClassLoader. Only if the * resource is not found by the parent do we attempt to load it from the coprocessor jar. @@ -349,6 +360,11 @@ public class CoprocessorClassLoader extends ClassLoaderBase { protected boolean isClassExempt(String name) { for (String exemptPrefix : CLASS_PREFIX_EXEMPTIONS) { if (name.startsWith(exemptPrefix)) { + for (String noExemptPrefix : CLASS_PREFIX_NO_EXEMPTION) { + if (name.startsWith(noExemptPrefix)) { + return false; + } + } return true; } }