public boolean createClassLoader(ClassLoaderFactory factory) throws DeploymentException { if (factory == null) throw new IllegalArgumentException("Null factory"); ClassLoader cl = getClassLoader(); if (cl != null) return false; try { cl = factory.createClassLoader(this); if (cl != null) { setClassLoader(cl); this.classLoaderFactory = factory; } } catch (Throwable t) { throw DeploymentException.rethrowAsDeploymentException("Error creating classloader for " + getName(), t); } return true; }
public boolean createClassLoader(ClassLoaderFactory factory) throws DeploymentException { if (factory == null) throw new IllegalArgumentException("Null factory"); ClassLoader cl = getClassLoader(); if (cl != null) return false; try { cl = factory.createClassLoader(getDeploymentUnit()); if (cl != null) { setClassLoader(cl); this.classLoaderFactory = factory; } else { // No classloader, use the deployer's classloader setClassLoader(Thread.currentThread().getContextClassLoader()); } } catch (Throwable t) { throw DeploymentException.rethrowAsDeploymentException("Error creating classloader for " + getName(), t); } return true; }