}
Class<?> containerClass = null;
try {
containerClass = loader.loadClass(containerCfg.className);
} catch (ClassNotFoundException e) {
throw new StartupException("Cannot locate container class", e);
}
if (containerClass == null) {
throw new StartupException("Component container class not loaded");
}
// create a new instance of the container object
Container containerObj = null;
try {
containerObj = (Container) containerClass.newInstance();
} catch (InstantiationException e) {
throw new StartupException("Cannot create " + containerCfg.name, e);
} catch (IllegalAccessException e) {
throw new StartupException("Cannot create " + containerCfg.name, e);
} catch (ClassCastException e) {
throw new StartupException("Cannot create " + containerCfg.name, e);
}
if (containerObj == null) {
throw new StartupException("Unable to create instance of component container");
}
// initialize the container object
try {
containerObj.init(args, configFile);
} catch (ContainerException e) {
throw new StartupException("Cannot init() " + containerCfg.name, e);
} catch (java.lang.AbstractMethodError e) {
throw new StartupException("Cannot init() " + containerCfg.name, e);
}
return containerObj;
}