452201 EnvConfiguration.destroy() should set the classloader

This commit is contained in:
Jan Bartel 2014-11-19 17:49:16 +11:00
parent 9792cec6db
commit a0f6d07847
1 changed files with 10 additions and 0 deletions

View File

@ -185,9 +185,14 @@ public class EnvConfiguration extends AbstractConfiguration
@Override
public void destroy (WebAppContext context) throws Exception
{
ClassLoader old_loader = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(context.getClassLoader());
ContextFactory.associateClassLoader(context.getClassLoader());
try
{
//unbind any NamingEntries that were configured in this webapp's name space
NamingContext scopeContext = (NamingContext)NamingEntryUtil.getContextForScope(context);
scopeContext.getParent().destroySubcontext(scopeContext.getName());
}
@ -196,6 +201,11 @@ public class EnvConfiguration extends AbstractConfiguration
LOG.ignore(e);
LOG.debug("No naming entries configured in environment for webapp "+context);
}
finally
{
ContextFactory.disassociateClassLoader();
Thread.currentThread().setContextClassLoader(old_loader);
}
}
/**