if (log.isLoggable(Level.FINE)) {
log.log(Level.FINE, "Entered loadUsingResourceLoader to load class.." + classname);
}
if (container != null) {
// find the ResourceLoader implementation
final ResourceLoader loader = container.getSPI(ResourceLoader.class);
if (loader != null) {
if (log.isLoggable(Level.FINE)) {
log.log(Level.FINE, "Obtained Non null ResourceLoader instance....");
}
try {
// JCAP's SPI implementation will return the directory from where the class(es) can be loaded
final URL classpathUrl = loader.getResource(classname);
// load the class using the URL
ClassLoader parent = this.getClass().getClassLoader();
URLClassLoader classloader = URLClassLoader.newInstance(new URL[]{classpathUrl}, parent);
ret = classloader.loadClass(classname);
return ret;