dependencies between sub-deployments & startup order
lkral Feb 29, 2012 2:25 PMI'm in the process of migrating an application from JBoss 5.1 to JBoss AS 7.1 .
The application is deployed as an EAR, which consists of at least 2 sub-deployments:
{quote}
myear.ear
+ META-INF
+ application.xml
+ jboss-app.xml
+ my-ejb.jar
+ META-INF
+ ejb-jar.xml
+ my-service.sar
+ META-INF
+ jboss-service.xml
{quote}
Here, the SAR deployment depends on a SLSB inside the EJB deployment, so we used the depends-tag in jboss-service.xml to allow the container (JBoss 5.1) to start the sub-deployments in the correct order:
{code:xml}
<mbean code="mypackage.MyJMXService" ...>
<depends>jboss.j2ee:module="my-ejb.jar",service=EjbModule</depends>
</mbean>
{code}
Now it is not clear to me how to declare this dependency in JBoss AS 7.1 . I tried to set the "initialize-in-order" option in the EAR deployment descriptor.
Unfortunately I did not find a working example, but from what I read in the schema definition, the following should be valid:
{code:xml}
<?xml version="1.0" encoding="UTF-8"?>
<jboss:jboss-app xmlns:jboss="http://www.jboss.com/xml/ns/javaee"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee http://www.jboss.org/j2ee/schema/jboss-app_7_0.xsd
http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_6.xsd"
version="6">
<display-name>MyApp</display-name>
<initialize-in-order>true</initialize-in-order>
<module>
<ejb>my-ejb.jar</ejb>
</module>
<jboss:module>
<jboss:service>my-service.sar</jboss:service>
</jboss:module>
</jboss:jboss-app>
{code}
Anyway, this does not solve my problem, so I get the following exception while a MBean performs some JNDI-Lookup during its start() method:
{quote}
java.lang.IllegalArgumentException: Could not find module app: myear module: my-ejb distinct name:
{quote}
Can somebody shed some light on this? Probably there is a simpler solution with dependency injection, so I do not need to set "initialize-in-order"?