Solving EAR deployment dependencies in WildFly and JBoss AS 7

This short tutorial show how you can support inter deployment dependencies on WildFly / JBoss AS 7.

If you have a deployment scenario like this, where you have multiple Enterprise applications which are required to be started up (and shut down) in a certain order:

jboss 7 ear dependencies

Then you can specify the deployment dependency using the jboss-all.xml file which is a JBoss custom XML descriptor for EAR archives. The jboss-all.xml file needs to be placed in the META-INF folder of your EAR archive.

Here’s for example how to solve the above dependency between the three EAR files:

app1.ear/META-INF/jboss-all.xml

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

app2.ear/META-INF/jboss-all.xml

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

Using a CLI Batch to guarantee deployment order

The deployment order enforced by jboss-all.xml requires, however, that both EAR files are available to the deployer at the same time. If you are deploying the dependent ear first, when the base ear is still not available your deployment will fail.

In this case, the best option to go is relying on a CLI batch which will be able to deploy both EAR files, whatever is the order used to deploy them:

batch

deploy app1.ear
deploy app2.ear

run-batch

References: https://issues.jboss.org/browse/AS7-5410?actionOrder=desc


Recommended Articles

Configure JBoss EAP/WildFly Deployment Order with Ease

Learn how to configure precise deployment order in EAR files and between multiple deployments using JBoss EAP/WildFly.

Optimize Your Enterprise Application with Correct Shared Library Placement in EAR Files

Learn how to correctly place shared libraries in an EAR file and customize WildFly configurations for optimal performance.

[Solved] Fix "Failed to start service jboss.deployment.unit" in WildFly

Learn how to solve the 'Failed to start service jboss.deployment.unit' error in WildFly & JBoss EAP. Decode deployment phases (.PARSE, .DEPENDENCIES, .INSTALL) and fix root causes.

Enable or Disable Hot Deployment in WildFly Application Server - A Comprehensive Guide

Learn how to control hot deployment in WildFly with CLI commands and configuration files for optimal performance.