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

Solution Verified - Updated

Environment

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

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>

Resolution

Update to EAP 6.4 CP12 or later

Root Cause

The BZ This content is not included.Redeploy dependent ear/war fails with duplicate resource error for persistence unit was opened to report this issue.

Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.