Redeploy dependent ear/war fails with duplicate rsource error for persistence unit in JBoss EAP 6.x

Solution Verified - Updated -

Issue

We have an EAR which depends on a WAR. If we undeploy the WAR and then redeploy it, an exception is thrown:

Caused by: java.lang.IllegalStateException: JBAS014666: Duplicate resource myear.ear/myejb.jar#ExamplePU

EAR has jboss-all.xml configuration like:

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

or jboss-deployment-structure.xml configuration like:

<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1">
    <deployment>
        <dependencies>
              <module name="deployment.mywar.war" />
        </dependencies>
    </deployment>
</jboss-deployment-structure>

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 6.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In