Thread currentThread = Thread.currentThread();
ClassLoader original = currentThread.getContextClassLoader();
RepositoryCache repositoryCache = EnvironmentImpl.getFromCurrent(RepositoryCache.class);
DeploymentClassLoader deploymentClassLoader = repositoryCache.getDeploymentClassLoader(deploymentId, original);
if (deploymentClassLoader==null) {
deploymentClassLoader = new DeploymentClassLoader(original, deploymentId);
repositoryCache.setDeploymentClassLoader(deploymentId, original, deploymentClassLoader);
}
currentThread.setContextClassLoader(deploymentClassLoader);