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 cf5ad96fcc
commit c812d13a47
1 changed files with 4 additions and 0 deletions

View File

@ -91,6 +91,10 @@ public class HBaseConfiguration extends Configuration {
*/
public static Configuration create() {
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);
}