public TomcatJndiSupport(RpcContainer container) throws OpenEJBException {
super(container);
try {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
Class contextBindings = classLoader.loadClass("org.apache.naming.ContextBindings");
bindContext = contextBindings.getMethod("bindContext", Object.class, Context.class, Object.class);
bindThread = contextBindings.getMethod("bindThread", Object.class, Object.class);
unbindThread = contextBindings.getMethod("unbindThread", Object.class, Object.class);
} catch (ClassNotFoundException e) {
throw new OpenEJBException("Unable to setup Tomcat JNDI support. Support requires the org.apache.naming.ContextBindings class to be available.");
} catch (NoSuchMethodException e) {
throw new OpenEJBException("Unable to setup Tomcat JNDI support. Method of org.apache.naming.ContextBindings was not found:" + e.getMessage());
}
DeploymentInfo[] deploymentInfos = container.deployments();
for (DeploymentInfo deploymentInfo : deploymentInfos) {
CoreDeploymentInfo deployment = (CoreDeploymentInfo) deploymentInfo;
setupDeployment(deployment);
}
}