App deploys fine in AS 6 CR1, but not in AS 6 Final (Dependency resolution)
franky_b Jan 4, 2011 8:28 AMHi guys,
I've a problem regarding dependency resolution in JBoss AS 6.0 Final. In our EAR that consists of several ejb-jar modules, we declare some stateless session beans with local and/or remote interfaces (using @Statless, @Local, @Remote etc.). Some of those session beans are injected into each other using the @EJB annotation. We also use some EJB 3.1 features such as @Singleton. The ejb-jar.xml looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd"
version="3.1">
</ejb-jar>
Now when I deploy the EAR in JBoss AS 6.0 CR1 (and M4 as well), it tries to build a "tree" of the beans to be able to deploy them in the right order. The log says for example:
13:59:16,888 INFO [JBossASKernel] Created KernelDeployment for: controller.jar
13:59:16,888 INFO [JBossASKernel] installing bean: jboss.j2ee:ear=nimbus.ear,jar=controller.jar,name=MetadataFacadeBean,service=EJB3
13:59:16,888 INFO [JBossASKernel] with dependencies:
13:59:16,888 INFO [JBossASKernel] and demands:
13:59:16,888 INFO [JBossASKernel] jboss.ejb:service=EJBTimerService; Required: Described
13:59:16,888 INFO [JBossASKernel] jndi:nimbus/InstanceServiceBean/local-cloud.controller.service.api.InstanceService; Required: Described
13:59:16,888 INFO [JBossASKernel] and supplies:
13:59:16,888 INFO [JBossASKernel] jndi:MetadataFacadeBean
13:59:16,888 INFO [JBossASKernel] Class:cloud.controller.facade.api.MetadataFacade
13:59:16,889 INFO [JBossASKernel] jndi:nimbus/MetadataFacadeBean/remote
13:59:16,889 INFO [JBossASKernel] jndi:nimbus/MetadataFacadeBean/remote-cloud.controller.facade.api.MetadataFacade
13:59:16,889 INFO [JBossASKernel] Added bean(jboss.j2ee:ear=nimbus.ear,jar=controller.jar,name=MetadataFacadeBean,service=EJB3) to KernelDeployment of: controller.jar
That's fine! The beans injected with @EJB are recognized and listed in the "and demands:" section.
BUT when I deploy exactly the same application to JBoss AS 6.0 Final it fails detecting the dependencies of the beans. The log now looks like this:
14:01:15,178 INFO [JBossASKernel] Created KernelDeployment for: controller.jar
14:01:15,178 INFO [JBossASKernel] installing bean: jboss.j2ee:ear=nimbus.ear,jar=controller.jar,name=MetadataFacadeBean,service=EJB3
14:01:15,178 INFO [JBossASKernel] with dependencies:
14:01:15,178 INFO [JBossASKernel] and demands:
14:01:15,178 INFO [JBossASKernel] jboss.ejb:service=EJBTimerService; Required: Described
14:01:15,178 INFO [JBossASKernel] jboss-switchboard:appName=nimbus,module=controller; Required: Create
14:01:15,178 INFO [JBossASKernel] jboss-injector:topLevelUnit=nimbus.ear,unit=controller.jar,bean=MetadataFacadeBean; Required: Described
14:01:15,178 INFO [JBossASKernel] and supplies:
14:01:15,179 INFO [JBossASKernel] jndi:MetadataFacadeBean
14:01:15,179 INFO [JBossASKernel] Class:cloud.controller.facade.api.MetadataFacade
14:01:15,179 INFO [JBossASKernel] jndi:nimbus/MetadataFacadeBean/remote
14:01:15,179 INFO [JBossASKernel] jndi:nimbus/MetadataFacadeBean/remote-cloud.controller.facade.api.MetadataFacade
14:01:15,179 INFO [JBossASKernel] Added bean(jboss.j2ee:ear=nimbus.ear,jar=controller.jar,name=MetadataFacadeBean,service=EJB3) to KernelDeployment of: controller.jar
Especially note the difference in the "and demands" section! Because no "demands" are determined, the beans are deployed in a rather random order. And sometimes, this random order is wrong, because A is deployed before B, but B is injected into A via @EJB.
Now I wonder about the differences in the deployment mechanisms of JBoss AS 6 CR1 (and below) compared to JBoss AS 6 Final? Is there anything special that got changed?
Cheers,
Frank