Support for EJB 2.1 SLSBs in AS 7.0.1?
rjbaty Aug 31, 2011 2:43 PMI've been tooling around with AS 7.0.1 a bit and have been able to get most of the newer applications working (EJB 3, JAX-WS, Servlet 3.0, etc.), however, I have run into a snag with some older EJB 2.1 applications that I have yet to upgrade. I'm wondering if the support for EJB 2.1 in AS 7.0.1 using the standalone-preview.xml configuration is there yet or if I should hold off doing anything with this until AS 7.1 ships?
My particular problem has to do with deploying an EJB 2.1 SLSB that contains an embedded resource-ref to a JDBC DataSource. Below should show the XML configuration:
ejb-jar.xml (EJB 2.1 DD)
<session> <display-name>Simple Stateless SessionBean that connects to MySQL using JDBC</display-name> <ejb-name>JDBCStateless</ejb-name> <local-home>rjb.jdbc.ejb.JDBCStatelessLocalHome</local-home> <local>rjb.jdbc.ejb.JDBCStatelessLocal</local> <ejb-class>rjb.jdbc.ejb.JDBCStatelessBean</ejb-class> <session-type>Stateless</session-type> <transaction-type>Container</transaction-type> <resource-ref> <res-ref-name>cookbook</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref> </session>
jboss.xml
<session> <ejb-name>JDBCStateless</ejb-name> <local-jndi-name>JDBCStatelessLocal</local-jndi-name> <resource-ref> <res-ref-name>cookbook</res-ref-name> <jndi-name>java:jboss/datasources/cookbook</jndi-name> </resource-ref> </session>
Upon deployment, it seems like this EJB 2.1 bean gets JNDI names like an EJB 3.0 bean, creating what I have seen from other EJB 3.0 beans. Afterwards there is a deployment failure with a circular reference for jboss-as. This is shown in the log output below:
13:28:34,987 INFO [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-3) JNDI bindings for session bean named JDBCStateless in deployment unit subdeployment "RJBatyEJB-4.2.jar" of deployment "RJBatyEJBEAR-3.2.ear" are as follows: java:global/RJBatyEJBEAR-3.2/RJBatyEJB-4.2/JDBCStateless!rjb.jdbc.ejb.JDBCStatelessBean java:app/RJBatyEJB-4.2/JDBCStateless!rjb.jdbc.ejb.JDBCStatelessBean java:module/JDBCStateless!rjb.jdbc.ejb.JDBCStatelessBean java:global/RJBatyEJBEAR-3.2/RJBatyEJB-4.2/JDBCStateless java:app/RJBatyEJB-4.2/JDBCStateless java:module/JDBCStateless 13:28:35,518 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC00001: Failed to start service jboss.deployment.subunit."RJBatyEJBEAR-3.2.ear"."RJBatyEJB-4.2.jar".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.subunit."RJBatyEJBEAR-3.2.ear"."RJBatyEJB-4.2.jar".INSTALL: Failed to process phase INSTALL of subdeployment "RJBatyEJB-4.2.jar" of deployment "RJBatyEJBEAR-3.2.ear" at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:121) at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1765) at org.jboss.msc.service.ServiceControllerImpl$ClearTCCLTask.run(ServiceControllerImpl.java:2291) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) [:1.6.0_21] at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [:1.6.0_21] at java.lang.Thread.run(Unknown Source) [:1.6.0_21] Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: Failed to install component org.jboss.as.ee.component.ComponentConfiguration[name=JDBCStateless class="rjb".jdbc.ejb.JDBCStatelessBean] at org.jboss.as.ee.component.ComponentInstallProcessor.deploy(ComponentInstallProcessor.java:77) at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:115) ... 5 more Caused by: org.jboss.msc.service.CircularDependencyException: Service jboss-as has a circular dependency at org.jboss.msc.service.ServiceContainerImpl.detectCircularity(ServiceContainerImpl.java:617) at org.jboss.msc.service.ServiceContainerImpl.detectCircularity(ServiceContainerImpl.java:588) at org.jboss.msc.service.ServiceContainerImpl.install(ServiceContainerImpl.java:562) at org.jboss.msc.service.ServiceTargetImpl.install(ServiceTargetImpl.java:201) at org.jboss.msc.service.ServiceControllerImpl$ChildServiceTarget.install(ServiceControllerImpl.java:2194) at org.jboss.msc.service.ServiceTargetImpl.install(ServiceTargetImpl.java:201) at org.jboss.msc.service.ServiceControllerImpl$ChildServiceTarget.install(ServiceControllerImpl.java:2194) at org.jboss.msc.service.ServiceBuilderImpl.install(ServiceBuilderImpl.java:307) at org.jboss.as.ee.component.ComponentInstallProcessor.processBindings(ComponentInstallProcessor.java:210) at org.jboss.as.ee.component.ComponentInstallProcessor.deployComponent(ComponentInstallProcessor.java:166) at org.jboss.as.ee.component.ComponentInstallProcessor.deploy(ComponentInstallProcessor.java:75) ... 6 more 13:28:35,628 INFO [org.jboss.as.server.controller] (pool-1-thread-1) Deployment of "RJBatyEJBEAR-3.2.ear" was rolled back with failure message {"Failed services" => {"jboss.deployment.subunit.\"RJBatyEJBEAR-3.2.ear\".\"RJBatyEJB-4.2.jar\".INSTALL" => "org.jboss.msc.service.StartException in service jboss.deployment.subunit.\"RJBatyEJBEAR-3.2.ear\".\"RJBatyEJB-4.2.jar\".INSTALL: Failed to process phase INSTALL of subdeployment \"RJBatyEJB-4.2.jar\" of deployment \"RJBatyEJBEAR-3.2.ear\""},"Services with missing/unavailable dependencies" => ["jboss.naming.context.java.comp.\"RJBatyEJBEAR-3.2\".\"RJBatyEJB-4.2\".JDBCStateless.Validator missing [ jboss.naming.context.java.comp.\"RJBatyEJBEAR-3.2\".\"RJBatyEJB-4.2\".JDBCStateless ]","jboss.naming.context.java.comp.\"RJBatyEJBEAR-3.2\".\"RJBatyEJB-4.2\".JDBCStateless.ValidatorFactory missing [ jboss.naming.context.java.comp.\"RJBatyEJBEAR-3.2\".\"RJBatyEJB-4.2\".JDBCStateless ]"]}
I am thinking it has somethign to do with the resource-ref but I have never seen a message like this and am wondering if anyone has some insights?
Thanks,
Robert