VZedano
VZedano

Reputation: 21

jboss-all.xml JBoss EAP 6.4 not taken in consideration (not working)

I have a JBoss EAP 6 instance, which has a couple of deployments (An EAR and a few WARs):

The thing is that on shutdown, I need myWar1.war to be undeployed after myEar.ear, but the actual result is that myEar.ear is being undeployed last, causing errors in the logs on shutdown due to the dependency.

I've already tried declaring dependencies of that war to the ear through jboss-deployment-structure.xml, and myWar1.war/WEB-INF/jboss-all.xml. Here are the examples:

myWar1.war/WEB-INF/jboss-deployment-structure.xml

<dependencies>
    <module name="deployment.myEar.ear">
        <imports>
            <exclude path="***" />
        </imports>
    </module>
    <module name="javax.annotation.api" />
</dependencies>

myWar1.war/WEB-INF/jboss-all.xml

<?xml version="1.0" encoding="UTF-8"?>
<jboss umlns="urn:jboss:1.0">
    <jboss-deployment-dependencies xmlns="urn:jboss:deployment-dependencies:1.0">
        <dependency name="myEar.ear" />
    </jboss-deployment-dependencies>
</jboss>      

None of these solutions seem to work. Although, it looks like jboss-all.xml is being read and parsed by JBoss, but it makes no effect on the order of undeployment of the dependant WAR on the EAR. (I guess it's not the expected behaviour, as states HERE.)

All the WARs are being deployed through JBoss CLI (then the server is restarted), but the myEar.ear is being exploded inside the server /deployments, and it's also added as a deployment through the CLI. Here are the entries for that in standalone-full.xml.

Also, the WAR is a SpringBoot application, built and packaged by Maven.

standalone-full.xml

<subsystem xmlns="urn:jboss:domain:deployment-scanner:1.1">
    <deployment-scanner path="deployments" relative-to="jboss.server.base.dir" scan-enabled="false" scan-interval="5000"/>
</subsystem>
<deployments>
    . . .
    <deployment name="myWar1.war" runtime-name="myWar1.war">
         <content sha1="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"/>
    </deployment>
    <deployment name="myEar" runtime-name="myEar.ear">
         <fs-exploded path="$JBOSS_HOME/standalone/deployments/myEar.ear"/>
    </deployment>
    . . .
</deployments>

Is there another way I can alter the undeployment sequence when shutting down JBoss? Is there a way to make jboss-all.xml be recognized properly by JBoss, or I am missing some configuration?

Upvotes: 2

Views: 1630

Answers (1)

Avery Sturzl
Avery Sturzl

Reputation: 92

The deployment dependencies tag in jboss-all.xml is usually referenced only for ensuring applications deploy after dependencies are established (As in your example myear has to be deployed before mywar1 deploys) but not for shutdown.

Commonly JBoss' command line commands (look up JBoss CLI) are used to handle startup, deployments and shutdowns, but the CLI is not meant to be invoked from within your program's code. There is a parallel api called the Management API, for the management interface, which has shutdown/startup functionality, and which is meant to be called from within your code.

The AS7 Management API is applicable to the JBoss EAP 6.x, as should the newest Wildfly version of the API. Only the wildfly api is supposed to be the most updated page for the API and it lists the startup/shutdown procedures though YMMV. Here is the wildfly API and the 6.x/AS7 api in case you run into issues using the wildfly reference. Here is how to use the Management Interface API programmatically.

Upvotes: 1

Related Questions