dplesa
dplesa

Reputation: 1425

How to deploy one .war after another on JBoss

Is there a way to define order of .war deployments on JBoss 7? What I would like to accomplish is that on startup of JBoss it first deploys .war A and then .war B.

I need this because .war A is a service which is consumed on a startup of .war B!

Upvotes: 1

Views: 2455

Answers (2)

António Ribeiro
António Ribeiro

Reputation: 4202

As mentioned in this JBoss's Forum thread, in order to ensure that A.war is deployed first than B.war, you should create a MANIFEST file under your B.war's src/main/webapp/META-INF folder, with the following entry:

dependencies: deployment.A.war

Furthermore, if you need to access A.war classes from B.war, you should also add a jboss-deployment-structure.xml, under your B.war's src/main/webapp/WEB-INF folder, with the following contents:

<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="urn:jboss:deployment-structure:1.2 http://www.jboss.org/schema/jbossas/jboss-deployment-structure-1_2.xsd">

    <deployment>
        <dependencies>
            <module name="deployment.A.war" export="true"/>
        </dependencies>
    </deployment>
</jboss-deployment-structure>

You can also take a look at JBoss AS 7 class loading documentation.

Upvotes: 0

Noe Fernandez
Noe Fernandez

Reputation: 114

You have to specify the dependency on the B war by creating a jboss-all.xml file on the META-INF folder,with a content like this:

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

The procedure is explained here Control the order of Deployed Applications on JBoss

Upvotes: 2

Related Questions