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:

<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="" xmlns:xsi=""
  version="6" xsi:schemaLocation="">


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:

<?xml version="1.0" encoding="UTF-8"?>
           <module name="deployment.app1.ear" />

Important! If you need to configure a dependency toward one or more EAR files, which are deployed separately, then you need to use jboss-all.xml file as follows:

<jboss umlns="urn:jboss:1.0">
    <jboss-deployment-dependencies xmlns="urn:jboss:deployment-dependencies:1.0">
        <dependency name="application1.ear" />
        <dependency name="application2.ear" />



Related articles available on

How to configure JBoss to disable hot deployment ?

On JBoss AS 7 and WildFly the default rule is that archived appli

How do I make sure my MBean is deployed after my EJB ?

  If your MBean is dependant on another resource, supposing cont

How do I change the default lib directory in an ear file?

  Supposing you have an Enterprise application which has been pa

How to let JBoss deploy an application after other apps?

  If you are running JBoss AS 7 or WildFly check the following t

How to deploy an application temporarly with JBoss ?

One way to do it, is using the jboss.system:service=MainDeployer

How to add a custom JBoss archive in an Ear ?

JBoss custom archives (like .sar or .har) are not recognized by t