try {
SystemInstance.init(initProps);
} catch (Exception e) {
throw new OpenEJBException(e);
}
SystemInstance system = SystemInstance.get();
SafeToolkit toolkit = SafeToolkit.getToolkit("OpenEJB");
if (appServer == null) {
ApplicationServer defaultServer = (ApplicationServer) toolkit.newInstance("org.apache.openejb.core.ServerFederation");
appServer = defaultServer;
}
system.setComponent(ApplicationServer.class, appServer);
/*
* Output startup message
*/
OpenEjbVersion versionInfo = OpenEjbVersion.get();
if (initProps.getProperty("openejb.nobanner") == null) {
System.out.println("Apache OpenEJB " + versionInfo.getVersion() + " build: " + versionInfo.getDate() + "-" + versionInfo.getTime());
System.out.println("" + versionInfo.getUrl());
}
Logger logger2 = Logger.getInstance(LogCategory.OPENEJB, "org.apache.openejb.util.resources");
logger2.info("startup.banner", versionInfo.getUrl(), new Date(), versionInfo.getCopyright(),
versionInfo.getVersion(), versionInfo.getDate(), versionInfo.getTime());
logger.info("openejb.home = " + SystemInstance.get().getHome().getDirectory().getAbsolutePath());
logger.info("openejb.base = " + SystemInstance.get().getBase().getDirectory().getAbsolutePath());
Properties props = new Properties(SystemInstance.get().getProperties());
if (initProps == null) {
logger.debug("startup.noInitializationProperties");
} else {
props.putAll(initProps);
}
/* Uses the EnvProps.ASSEMBLER property to obtain the Assembler impl.
Default is org.apache.openejb.assembler.classic.Assembler */
String className = props.getProperty(EnvProps.ASSEMBLER);
if (className == null) {
className = props.getProperty("openejb.assembler", "org.apache.openejb.assembler.classic.Assembler");
} else {
logger.warning("startup.deprecatedPropertyName", EnvProps.ASSEMBLER);
}
logger.debug("startup.instantiatingAssemberClass", className);
Assembler assembler = null;
try {
assembler = (Assembler) toolkit.newInstance(className);
} catch (OpenEJBException oe) {
logger.fatal("startup.assemblerCannotBeInstanitated", oe);
throw oe;
} catch (Throwable t) {
String msg = messages.message("startup.openEjbEncounterUnexpectedError");
logger.fatal(msg, t);
throw new OpenEJBException(msg, t);
}
SystemInstance.get().setComponent(Assembler.class, assembler);
try {
assembler.init(props);
} catch (OpenEJBException oe) {
logger.fatal("startup.assemblerFailedToInitialize", oe);
throw oe;
} catch (Throwable t) {
String msg = messages.message("startup.assemblerEncounterUnexpectedError");
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");
DeploymentInfo[] 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 STATELESS:
entry += "STATELESS ";
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);