HBASE-12108 | Setting classloader so that HBase resources resolve even when HBaseConfiguration is loaded from a different class loader

Signed-off-by: stack <stack@apache.org>
This commit is contained in:
Aniket Bhatnagar 2015-01-13 11:02:24 +05:30 committed by stack
parent 44596148c7
commit 0fa6eedcdb
1 changed files with 4 additions and 0 deletions

View File

@ -89,6 +89,10 @@ public class HBaseConfiguration extends Configuration {
*/ */
public static Configuration create() { public static Configuration create() {
Configuration conf = new Configuration(); Configuration conf = new Configuration();
// In case HBaseConfiguration is loaded from a different classloader than
// Configuration, conf needs to be set with appropriate class loader to resolve
// HBase resources.
conf.setClassLoader(HBaseConfiguration.class.getClassLoader());
return addHbaseResources(conf); return addHbaseResources(conf);
} }