// the openejb classes were added to the system class path so the WebService anntation
// will not be present on the class
ClassLoader tempClassLoader = ClassLoaderUtil.createTempClassLoader(standardContext.getLoader().getClassLoader());
for (Container container : standardContext.findChildren()) {
if (container instanceof Wrapper) {
Wrapper wrapper = (Wrapper) container;
String servletClass = wrapper.getServletClass();
try {
Class<?> clazz = tempClassLoader.loadClass(servletClass);
if (JaxWsUtils.isWebService(clazz)) {
wrapper.setServletClass(WsServlet.class.getName());
if (getServlet(wrapper) != null) {
wrapper.load();
wrapper.unload();
}
}
} catch (Exception e) {
// will be reported by the tomcat
}
}
}
// bind extra stuff at the java:comp level which can only be
// bound after the context is created
String listenerName = getNamingContextListener(standardContext).getName();
ContextAccessController.setWritable(listenerName, standardContext);
try {
Context openejbContext = SystemInstance.get().getComponent(ContainerSystem.class).getJNDIContext();
openejbContext = (Context) openejbContext.lookup("openejb");
Context root = (Context) ContextBindings.getClassLoader().lookup("");
safeBind(root, "openejb", openejbContext);
Context comp = (Context) ContextBindings.getClassLoader().lookup("comp");
// add context to WebDeploymentInfo
for (WebAppInfo webAppInfo : contextInfo.appInfo.webApps) {
if (("/" + webAppInfo.contextRoot).equals(standardContext.getPath())) {
CoreWebDeploymentInfo webDeploymentInfo = (CoreWebDeploymentInfo) getContainerSystem().getWebDeploymentInfo(webAppInfo.moduleId);
if (webDeploymentInfo != null) {
webDeploymentInfo.setJndiEnc(comp);
}
break;
}
}
// bind TransactionManager
TransactionManager transactionManager = SystemInstance.get().getComponent(TransactionManager.class);
safeBind(comp, "TransactionManager", transactionManager);
// bind TransactionSynchronizationRegistry
TransactionSynchronizationRegistry synchronizationRegistry = SystemInstance.get().getComponent(TransactionSynchronizationRegistry.class);
safeBind(comp, "TransactionSynchronizationRegistry", synchronizationRegistry);
safeBind(comp, "ORB", new SystemComponentReference(ORB.class));
safeBind(comp, "HandleDelegate", new SystemComponentReference(HandleDelegate.class));
} catch (NamingException e) {
}
ContextAccessController.setReadOnly(listenerName);
if (!TomcatVersion.hasAnnotationProcessingSupport()){
try {
Context compEnv = (Context) ContextBindings.getClassLoader().lookup("comp/env");
LegacyAnnotationProcessor annotationProcessor = new LegacyAnnotationProcessor(compEnv);
standardContext.addContainerListener(new ProcessAnnotatedListenersListener(annotationProcessor));
for (Container container : standardContext.findChildren()) {
if (container instanceof Wrapper) {
Wrapper wrapper = (Wrapper) container;
wrapper.addInstanceListener(new ProcessAnnotatedServletsListener(annotationProcessor));
}
}
} catch (NamingException e) {
}
}