if ((loader != null) && (loader instanceof Lifecycle))
((Lifecycle) loader).start();
- // Unbinding thread
+ // since the loader just started, the webapp classloader is now
+ // created by calling unbindThread and bindThread in a row, we
+ // setup the current Thread CCL to be the webapp classloader
unbindThread(oldCCL);
-
- // Binding thread
oldCCL = bindThread();
// Initialize logger again. Other components might have used it too early,
(getLoader().getClassLoader());
}
- DirContextURLStreamHandler.bind(getResources());
+ DirContextURLStreamHandler.bindThread(getResources());
if (isUseNaming()) {
try {
*/
private void unbindThread(ClassLoader oldContextClassLoader) {
- Thread.currentThread().setContextClassLoader(oldContextClassLoader);
-
- oldContextClassLoader = null;
-
if (isUseNaming()) {
ContextBindings.unbindThread(this, this);
}
- DirContextURLStreamHandler.unbind();
+ DirContextURLStreamHandler.unbindThread();
+ Thread.currentThread().setContextClassLoader(oldContextClassLoader);
}