-
1. Re: Deploying WAR file after EAR
erasmomarciano Oct 24, 2013 6:21 AM (in response to sergiu_pienar)You can configure JBoss AS deployment order inside an EAR with a simple trick, here we will show how to do it!
If you are using application.xml 6.0 schema you have an handy element named initialize-in-order which, if set to true, initializes the modules in the same order they are listed. For example here the webapp.war will be initialized as first module of the ear:
01.
<?
xml
version
=
"1.0"
encoding
=
"UTF-8"
?>
02.
<
application
xmlns
=
"http://java.sun.com/xml/ns/javaee"
xmlns:xsi
=
"http://www.w3.org/2001/XMLSchema-instance"
03.
version
=
"6"
xsi:schemaLocation
=
"http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_6.xsd"
>
04.
05.
<
application-name
>sampleapp</
application-name
>
06.
<
initialize-in-order
>true</
initialize-in-order
>
07.
<
module
>
08.
<
web
>
09.
<
web-uri
>webapp.war</
web-uri
>
10.
<
context-root
>test</
context-root
>
11.
</
web
>
12.
</
module
>
13.
14.
<
module
>
15.
<
ejb
>core-ejb.jar</
ejb
>
16.
</
module
>
17.
18.
</
application
>
What if you need configuring the deployment order between two applications, say two EAR files ? then you can use jboss-deployment-structure.xml. jboss-deployment-structure.xml is a JBoss specific deployment descriptor that can be used to control class loading in a fine grained manner. It should be placed in the top level deployment, in META-INF (or WEB-INF for web deployments).
For example, let's say you have app1.ear and app2.ear. Here we configured the deployment structure of app2.ear to depend on app1.ear, so that the former will be deployed first:
1.
<?
xml
version
=
"1.0"
encoding
=
"UTF-8"
?>
2.
<
jboss-deployment-structure
>
3.
<
deployment
>
4.
<
dependencies
>
5.
<
module
name
=
"deployment.app1.ear"
/>
6.
</
dependencies
>
7.
</
deployment
>
8.
</
jboss-deployment-structure
>
-
2. Re: Deploying WAR file after EAR
sergiu_pienar Oct 24, 2013 6:25 AM (in response to erasmomarciano)Thanks!