doBootstrapShutdown(appInfo);
} finally {
// ignore.
}
String msgPrefix = getDeploymentErrorMsgPrefix( t );
DeploymentException de = new DeploymentException(msgPrefix + t.getMessage());
de.initCause(t);
throw(de);
} finally {
invocationManager.popAppEnvironment();
//The TCL is originally the EAR classloader
//and is reset during Bean deployment to the
//corresponding module classloader in BeanDeploymentArchiveImpl.getBeans
//for Bean classloading to succeed. The TCL is reset
//to its old value here.
Thread.currentThread().setContextClassLoader(oldTCL);
}
}
} else if ( event.is(org.glassfish.internal.deployment.Deployment.APPLICATION_STARTED) ) {
ApplicationInfo appInfo = (ApplicationInfo)event.hook();
WeldBootstrap bootstrap = appInfo.getTransientAppMetaData(WELD_BOOTSTRAP,
WeldBootstrap.class);
if( bootstrap != null ) {
final String fAppName = appInfo.getName();
invocationManager.pushAppEnvironment(new ApplicationEnvironment() {
@Override
public String getName() {
return fAppName;
}
});
try {
bootstrap.validateBeans();
bootstrap.endInitialization();
} catch (Throwable t) {
try {
doBootstrapShutdown(appInfo);
} finally {
// ignore.
}
String msgPrefix = getDeploymentErrorMsgPrefix( t );
DeploymentException de = new DeploymentException( msgPrefix + t.getMessage());
de.initCause(t);
throw(de);
}
finally {
invocationManager.popAppEnvironment();
}