Reputation: 13571
Is there a mechanism either within the ear file itself (jboss-app.xml) or a configuration on the server to ensure that an EAR is loaded last and/or after another ear? For example
something like:
<load-precedence>
web-services.ear
enterprise-app.ear
</load-precedence>
Upvotes: 4
Views: 2275
Reputation: 5261
I'm using EAR suffix configuration order in conf/bootstrap/deployers.xml
. The value is ranged from 50 (started first) and 950 (started last), see LegacyDeploymentContextComparator class. In your case you would get:
<bean name="topContextComparator">
<constructor factoryClass="org.jboss.system.deployers.LegacyDeploymentContextComparator" factoryMethod="getInstance"/>
<property name="suffixOrder" class="java.util.Map">
<map keyClass="java.lang.String" valueClass="java.lang.Integer">
<entry>
<key>web-services.ear</key>
<value>500</value>
</entry>
<entry>
<key>enterprise-app.ear</key>
<value>600</value>
</entry>
</map>
</property>
</bean>
I also use generic suffix configuration such as _<N>.ear
where <N>
is the starting order. This avoids changing the deployers.xml
file each time I deploy a new EAR. This is useful when deploying versioned EARs such as MyEar_v20130611_3.ear
(in that case N=3):
<entry>
<key>_1.ear</key>
<value>500</value>
</entry>
<entry>
<key>_2.ear</key>
<value>600</value>
</entry>
<entry>
<key>_3.ear</key>
<value>700</value>
</entry>
Upvotes: 1
Reputation: 8422
I've never used JBoss as an app server but looking at this documentation:
There is a Deployment Sorter that seems like it might be what you're looking for.
Upvotes: 2
Reputation: 13727
It would be handy if there was; I don't know of one. We have EAR's that depend on other EARs. Our startup code runs in a thread and re-tries on an interval until the EJB's in the other EAR are available.
Upvotes: 3