10.7. Control the order of Deployed Applications on JBoss EAP 6
JBoss EAP 6 offers fine grained control over the order of deployment of applications when the server is started. Strict order of deployment of applications present in multiple ear files can be enabled along with persistence of the order after a restart.
Procedure 10.16. Control the order of deployment in EAP 6.0
- Create CLI scripts that will deploy and undeploy the applications in sequential order when the server is started/stopped.
- CLI also supports the concept of batch mode which allows you to group commands and operations and execute them together as an atomic unit. If at least one of the commands or operations fails, all the other successfully executed commands and operations in the batch are rolled back.
Procedure 10.17. Control the order of deployment in EAP 6.1 and later
From EAP 6.1 onward, Inter Deployment Dependencies allows you to declare dependencies between top level deployments.
- Create (if it doesn't exist) a
jboss-all.xmlfile in the
app.earis the application archive that depends on another application archive to be deployed before it is.
- Make a
jboss-deployment-dependenciesentry in this file as shown below. Note that in the listing below,
framework.earis the dependency application archive that should be deployed before
app.earapplication archive is.
<jboss umlns="urn:jboss:1.0"> <jboss-deployment-dependencies xmlns="urn:jboss:deployment-dependencies:1.0"> <dependency name="framework.ear" /> </jboss-deployment-dependencies> </jboss>
NoteYou can use the deployment's runtime name as the dependency name in the
jboss-all.xmlfile allows you to declare dependencies that the server does not otherwise detect, it is not a strict ordering feature. JBoss EAP assumes that all dependencies specified in the
jboss-all.xmlfile have already been deployed or are available. If there are missing dependencies, JBoss EAP does not automatically deploy them, and the deployment fails.