// Get the classloader actually used by HBaseConfiguration ClassLoaderclassLoader= HBaseConfiguration.create().getClassLoader(); if (!(classLoader instanceof URLClassLoader)) { fail("We should get a URLClassLoader"); }
// Make the addURL method accessible Methodmethod= URLClassLoader.class.getDeclaredMethod("addURL", URL.class); method.setAccessible(true);
// Add the directory where we put the hbase-site.xml to the classpath method.invoke(classLoader, directory.toURI().toURL());