services.put(ContextsService.class, new CdiAppContextsService(true));
services.put(ResourceInjectionService.class, new CdiResourceInjectionService());
services.put(ScannerService.class, new CdiScanner());
WebBeansContext webBeansContext = new WebBeansContext(services, properties);
//must be last since it copies stuff
OpenEJBLifecycle lifecycle = new OpenEJBLifecycle(webBeansContext);
webBeansContext.registerService(ContainerLifecycle.class, lifecycle);
WebBeansContext oldContext = GeronimoSingletonService.contextEntered(webBeansContext);
//from OWB's WebBeansConfigurationListener
try {
if (startup == null) {
//this should only be used for servlet tests
StartupObject startupObject = new StartupObject(new AppContext("none", SystemInstance.get(), Thread.currentThread().getContextClassLoader(), null, null, true), new AppInfo(),
Collections.<BeanContext> emptyList());
lifecycle.startApplication(startupObject);
//lifecycle.startServletContext((ServletContext)startup);
} else if (startup instanceof StartupObject) {
lifecycle.startApplication(startup);
//((StartupObject)startup).getAppContext().setWebBeansContext(webBeansContext);
}
} catch (Exception e) {
//logger.error(OWBLogConst.ERROR_0018, event.getServletContext().getContextPath());
WebBeansUtil.throwRuntimeExceptions(e);