SystemInstance.init(initProps);
OptionsLog.install();
} catch (Exception e) {
throw new OpenEJBException(e);
}
SystemInstance system = SystemInstance.get();
system.setComponent(DeploymentExceptionManager.class, new DeploymentExceptionManager());
system.setComponent(ApplicationServer.class, appServer);
OpenEjbVersion versionInfo = OpenEjbVersion.get();
if (!system.getOptions().get("openejb.nobanner", true)) {
versionInfo.print(System.out);
}
Logger logger2 = Logger.getInstance(LogCategory.OPENEJB, "org.apache.openejb.util.resources");
final String[] bannerValues = new String[] {
null, versionInfo.getUrl(), new Date().toString(), versionInfo.getCopyright(),
versionInfo.getVersion(), versionInfo.getDate(), versionInfo.getTime(), null
};
for (int i = 0; i < bannerValues.length; i++) {
if (bannerValues[i] == null) {
logger2.info("startup.banner." + i);
} else {
logger2.info("startup.banner." + i, bannerValues[i]);
}
}
logger.info("openejb.home = " + system.getHome().getDirectory().getAbsolutePath());
logger.info("openejb.base = " + system.getBase().getDirectory().getAbsolutePath());
//OWB support. The classloader has to be able to load all OWB components including the ones supplied by OpenEjb.
CdiBuilder.initializeOWB(getClass().getClassLoader());
String className = system.getOptions().get("openejb.assembler", "org.apache.openejb.assembler.classic.Assembler");
logger.debug("startup.instantiatingAssemblerClass", className);
Assembler assembler;
try {
assembler = (Assembler) SafeToolkit.getToolkit("OpenEJB").newInstance(className);
} catch (OpenEJBException oe) {
logger.fatal("startup.assemblerCannotBeInstantiated", oe);
throw oe;
} catch (Throwable t) {
String msg = messages.message("startup.openejbEncounteredUnexpectedError");
logger.fatal(msg, t);
throw new OpenEJBException(msg, t);
}
try {
assembler.init(system.getProperties());
} catch (OpenEJBException oe) {
logger.fatal("startup.assemblerFailedToInitialize", oe);
throw oe;
} catch (Throwable t) {
String msg = messages.message("startup.assemblerEncounteredUnexpectedError");
logger.fatal(msg, t);
throw new OpenEJBException(msg, t);
}
try {
assembler.build();
} catch (OpenEJBException oe) {
logger.fatal("startup.assemblerFailedToBuild", oe);
throw oe;
} catch (Throwable t) {
String msg = messages.message("startup.assemblerEncounterUnexpectedBuildError");
logger.fatal(msg, t);
throw new OpenEJBException(msg, t);
}
ContainerSystem containerSystem = assembler.getContainerSystem();
if (containerSystem == null) {
String msg = messages.message("startup.assemblerReturnedNullContainer");
logger.fatal(msg);
throw new OpenEJBException(msg);
}
system.setComponent(ContainerSystem.class, containerSystem);
if (logger.isDebugEnabled()) {
logger.debug("startup.debugContainers", containerSystem.containers().length);
if (containerSystem.containers().length > 0) {
Container[] c = containerSystem.containers();
logger.debug("startup.debugContainersType");
for (int i = 0; i < c.length; i++) {
String entry = " ";
switch (c[i].getContainerType()) {
case BMP_ENTITY:
entry += "BMP ENTITY ";
break;
case CMP_ENTITY:
entry += "CMP ENTITY ";
break;
case STATEFUL:
entry += "STATEFUL ";
break;
case STATELESS:
entry += "STATELESS ";
break;
case MESSAGE_DRIVEN:
entry += "MESSAGE ";
break;
}
entry += c[i].getContainerID();
logger.debug("startup.debugEntry", entry);
}
}
logger.debug("startup.debugDeployments", containerSystem.deployments().length);
if (containerSystem.deployments().length > 0) {
logger.debug("startup.debugDeploymentsType");
BeanContext[] d = containerSystem.deployments();
for (int i = 0; i < d.length; i++) {
String entry = " ";
switch (d[i].getComponentType()) {
case BMP_ENTITY:
entry += "BMP_ENTITY ";
break;
case CMP_ENTITY:
entry += "CMP_ENTITY ";
break;
case STATEFUL:
entry += "STATEFUL ";
break;
case MANAGED:
entry += "MANAGED ";
break;
case STATELESS:
entry += "STATELESS ";
break;
case SINGLETON:
entry += "SINGLETON ";
break;
case MESSAGE_DRIVEN:
entry += "MESSAGE ";
break;
}
entry += d[i].getDeploymentID();
logger.debug("startup.debugEntry", entry);
}
}
}
SecurityService securityService = assembler.getSecurityService();
if (securityService == null) {
String msg = messages.message("startup.assemblerReturnedNullSecurityService");
logger.fatal(msg);
throw new OpenEJBException(msg);
} else {
logger.debug("startup.securityService", securityService.getClass().getName());
}
system.setComponent(SecurityService.class, securityService);
TransactionManager transactionManager = assembler.getTransactionManager();
if (transactionManager == null) {
String msg = messages.message("startup.assemblerReturnedNullTransactionManager");
logger.fatal(msg);
throw new OpenEJBException(msg);
} else {
logger.debug("startup.transactionManager", transactionManager.getClass().getName());
}
system.setComponent(TransactionManager.class, transactionManager);
logger.debug("startup.ready");
}