5 Replies Latest reply on Jul 15, 2015 12:42 AM by felix.mgn

    Redeploy dependent ear fails with duplicate resource error for persistence unit

    felix.mgn

      I have two EARs:

      module1.ear
      |
      +--ejb.jar
         |
        +--META-INF
            |
            +--persistence.xml with persistence unit "module1-pu"
      
      
      

      and

      module2.ear
      |
      +--META-INF
      |  |
      |  +--jboss-all.xml
      |
      +--ejb.jar
         |
         +--META-INF
            |
            +--persistence.xml with persistence unit "module2-pu"
      
      
      

       

       

      module2.ear/META-INF/jboss-all.xml contains:

       

       

      <jboss xmlns="urn:jboss:1.0">
        <jboss-deployment-dependencies xmlns="urn:jboss:deployment-dependencies:1.0">
        <dependency name="module1.ear" />
        </jboss-deployment-dependencies>
      </jboss>
      
      
      

       

      When I redeploy module1.ear, module2.ear not redeployed automatically with error "JBAS014666: Duplicate resource module2.ear/ejb.jar#module2-pu".

      I'm trying this on Wildfly 8.2.0.Final and Wildfly 9.0.0.CR2

       

       

      Full redeploy log:

      14:32:30,793 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 99) JBAS011410: Stopping Persistence Unit (phase 2 of 2) Service 'module2.ear/ejb.jar#module2-pu'
      14:32:30,794 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 99) JBAS010282: Stopped module2.ear/ejb.jar#module2-pu.org.hibernate.cache.internal.StandardQueryCache cache from hibernate container
      14:32:30,794 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 99) JBAS010282: Stopped module2.ear/ejb.jar#module2-pu.org.hibernate.cache.spi.UpdateTimestampsCache cache from hibernate container
      14:32:30,796 INFO [org.jboss.weld.deployer] (MSC service thread 1-3) JBAS016009: Stopping weld service for deployment module2.ear
      14:32:30,798 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 99) JBAS011410: Stopping Persistence Unit (phase 1 of 2) Service 'module2.ear/ejb.jar#module2-pu'
      14:32:30,800 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 99) JBAS011410: Stopping Persistence Unit (phase 2 of 2) Service 'module1.ear/ejb.jar#module1-pu'
      14:32:30,801 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 99) JBAS010282: Stopped module1.ear/ejb.jar#module1-pu.org.hibernate.cache.internal.StandardQueryCache cache from hibernate container
      14:32:30,801 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 99) JBAS010282: Stopped module1.ear/ejb.jar#module1-pu.org.hibernate.cache.spi.UpdateTimestampsCache cache from hibernate container
      14:32:30,805 INFO [org.jboss.weld.deployer] (MSC service thread 1-2) JBAS016009: Stopping weld service for deployment module1.ear
      14:32:30,807 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 99) JBAS011410: Stopping Persistence Unit (phase 1 of 2) Service 'module1.ear/ejb.jar#module1-pu'
      14:32:30,809 INFO [org.jboss.as.server.deployment] (MSC service thread 1-2) JBAS015974: Stopped subdeployment (runtime-name: ejb.jar) in 76ms
      14:32:30,812 INFO [org.jboss.as.server.deployment] (MSC service thread 1-2) JBAS015877: Stopped deployment module1.ear (runtime-name: module1.ear) in 79ms
      14:32:30,815 WARN [org.jboss.as.jpa] (management-handler-thread - 40) JBAS011411: Unexpected problem gathering statistics: java.lang.IllegalStateException: JBAS011477: Persistence unit 'module2.ear/ejb.jar#module2-pu' is not available
        .... (stacktrace)
      14:32:30,818 WARN [org.jboss.as.jpa] (management-handler-thread - 40) JBAS011411: Unexpected problem gathering statistics: java.lang.IllegalStateException: JBAS011477: Persistence unit 'module2.ear/ejb.jar#module2-pu' is not available
        .... (stacktrace)
      14:32:30,821 WARN [org.jboss.as.jpa] (management-handler-thread - 40) JBAS011411: Unexpected problem gathering statistics: java.lang.IllegalStateException: JBAS011477: Persistence unit 'module2.ear/ejb.jar#module2-pu' is not available
        .... (stacktrace)
      14:32:30,823 WARN [org.jboss.as.jpa] (management-handler-thread - 40) JBAS011411: Unexpected problem gathering statistics: java.lang.IllegalStateException: JBAS011477: Persistence unit 'module2.ear/ejb.jar#module2-pu' is not available
        .... (stacktrace)
      14:32:30,874 INFO [org.jboss.as.server] (management-handler-thread - 40) JBAS018558: Undeployed "module1.ear" (runtime-name: "module1.ear")
      14:32:30,874 INFO [org.jboss.as.controller] (management-handler-thread - 40) JBAS014774: Service status report
      JBAS014775: New missing/unsatisfied dependencies:
        service jboss.deployment.unit."module1.ear".deploymentCompleteService (missing) dependents: [service jboss.deployment.subunit."module2.ear"."ejb.jar".PARSE, service jboss.deployment.unit."module2.ear".PARSE]
      14:32:30,877 WARN [org.jboss.as.jpa] (management-handler-thread - 40) JBAS011411: Unexpected problem gathering statistics: java.lang.IllegalStateException: JBAS011477: Persistence unit 'module2.ear/ejb.jar#module2-pu' is not available
        .... (stacktrace)
      14:32:30,879 WARN [org.jboss.as.jpa] (management-handler-thread - 40) JBAS011411: Unexpected problem gathering statistics: java.lang.IllegalStateException: JBAS011477: Persistence unit 'module2.ear/ejb.jar#module2-pu' is not available
        .... (stacktrace)
      14:32:30,882 WARN [org.jboss.as.jpa] (management-handler-thread - 40) JBAS011411: Unexpected problem gathering statistics: java.lang.IllegalStateException: JBAS011477: Persistence unit 'module2.ear/ejb.jar#module2-pu' is not available
        .... (stacktrace)
      14:32:30,885 WARN [org.jboss.as.jpa] (management-handler-thread - 40) JBAS011411: Unexpected problem gathering statistics: java.lang.IllegalStateException: JBAS011477: Persistence unit 'module2.ear/ejb.jar#module2-pu' is not available
        .... (stacktrace)
      14:32:30,940 INFO [org.jboss.as.repository] (management-handler-thread - 37) JBAS014901: Content removed from location /opt/wildfly/standalone/data/content/76/9d07427cc5badde07b85b054e6661c4ee08043/content
      14:35:58,747 INFO [org.jboss.as.repository] (management-handler-thread - 43) JBAS014900: Content added at location /opt/wildfly/standalone/data/content/76/9d07427cc5badde07b85b054e6661c4ee08043/content
      14:35:38,750 WARN [org.jboss.as.jpa] (management-handler-thread - 40) JBAS011411: Unexpected problem gathering statistics: java.lang.IllegalStateException: JBAS011477: Persistence unit 'module2.ear/ejb.jar#module2-pu' is not available
        .... (stacktrace)
      14:35:38,752 WARN [org.jboss.as.jpa] (management-handler-thread - 40) JBAS011411: Unexpected problem gathering statistics: java.lang.IllegalStateException: JBAS011477: Persistence unit 'module2.ear/ejb.jar#module2-pu' is not available
        .... (stacktrace)
      14:35:38,754 WARN [org.jboss.as.jpa] (management-handler-thread - 40) JBAS011411: Unexpected problem gathering statistics: java.lang.IllegalStateException: JBAS011477: Persistence unit 'module2.ear/ejb.jar#module2-pu' is not available
        .... (stacktrace)
      14:35:38,756 WARN [org.jboss.as.jpa] (management-handler-thread - 40) JBAS011411: Unexpected problem gathering statistics: java.lang.IllegalStateException: JBAS011477: Persistence unit 'module2.ear/ejb.jar#module2-pu' is not available
        .... (stacktrace)
      14:35:58,818 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015876: Starting deployment of "module1.ear" (runtime-name: "module1.ear")
      14:35:58,988 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015973: Starting subdeployment (runtime-name: "ejb.jar")
      14:35:58,989 INFO [org.jboss.as.jpa] (MSC service thread 1-4) JBAS011401: Read persistence.xml for module1-pu
      14:35:59,002 INFO [org.jboss.weld.deployer] (MSC service thread 1-2) JBAS016002: Processing weld deployment module1.ear
      14:35:59,005 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 102) JBAS011409: Starting Persistence Unit (phase 1 of 2) Service 'module1.ear/ejb.jar#module1-pu'
      14:35:59,005 INFO [org.hibernate.jpa.internal.util.LogHelper] (ServerService Thread Pool -- 102) HHH000204: Processing PersistenceUnitInfo [
        name: module1-pu
        ...]
      14:35:59,047 INFO [org.jboss.weld.deployer] (MSC service thread 1-2) JBAS016002: Processing weld deployment ejb.jar
      14:35:59,050 INFO [org.jboss.weld.deployer] (MSC service thread 1-1) JBAS016005: Starting Services for CDI deployment: module1.ear
      14:35:59,051 INFO [org.jboss.weld.deployer] (MSC service thread 1-3) JBAS016008: Starting weld service for deployment module1.ear
      14:35:59,058 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 102) JBAS011409: Starting Persistence Unit (phase 2 of 2) Service 'module1.ear/ejb.jar#module1-pu'
      14:35:59,071 INFO [org.hibernate.dialect.Dialect] (ServerService Thread Pool -- 102) HHH000400: Using dialect: org.hibernate.dialect.PostgreSQL9Dialect
      14:35:59,072 INFO [org.hibernate.engine.jdbc.internal.LobCreatorBuilder] (ServerService Thread Pool -- 102) HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException
      14:35:59,077 INFO [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (ServerService Thread Pool -- 102) HHH000397: Using ASTQueryTranslatorFactory
      14:35:59,078 INFO [org.hibernate.cache.spi.UpdateTimestampsCache] (ServerService Thread Pool -- 102) HHH000250: Starting update timestamps cache at region: module1.ear/ejb.jar#module1-pu.org.hibernate.cache.spi.UpdateTimestampsCache
      14:35:59,079 INFO [org.infinispan.jmx.CacheJmxRegistration] (ServerService Thread Pool -- 102) ISPN000031: MBeans were successfully registered to the platform MBean server.
      14:35:59,079 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 102) JBAS010281: Started module1.ear/ejb.jar#module1-pu.org.hibernate.cache.spi.UpdateTimestampsCache cache from hibernate container
      14:35:59,079 INFO [org.hibernate.cache.internal.StandardQueryCache] (ServerService Thread Pool -- 102) HHH000248: Starting query cache at region: module1.ear/ejb.jar#module1-pu.org.hibernate.cache.internal.StandardQueryCache
      14:35:59,082 INFO [org.infinispan.jmx.CacheJmxRegistration] (ServerService Thread Pool -- 102) ISPN000031: MBeans were successfully registered to the platform MBean server.
      14:35:59,082 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 102) JBAS010281: Started module1.ear/ejb.jar#module1-pu.org.hibernate.cache.internal.StandardQueryCache cache from hibernate container
      14:35:59,193 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015971: Deployment restart detected for deployment module2.ear, performing full redeploy instead.
      14:35:59,193 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015971: Deployment restart detected for deployment ejb.jar, performing full redeploy instead.
      14:35:59,193 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015974: Stopped subdeployment (runtime-name: ejb.jar) in 0ms
      14:35:59,196 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015877: Stopped deployment module2.ear (runtime-name: module2.ear) in 2ms
      14:35:59,196 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015876: Starting deployment of "module2.ear" (runtime-name: "module2.ear")
      14:35:59,319 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015973: Starting subdeployment (runtime-name: "ejb.jar")
      14:35:59,321 INFO [org.jboss.as.jpa] (MSC service thread 1-3) JBAS011401: Read persistence.xml for module2-pu
      14:35:59,328 INFO [org.jboss.weld.deployer] (MSC service thread 1-4) JBAS016002: Processing weld deployment module2.ear
      14:35:59,329 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 102) JBAS011409: Starting Persistence Unit (phase 1 of 2) Service 'module2.ear/ejb.jar#module2-pu'
      14:35:59,329 INFO [org.hibernate.jpa.internal.util.LogHelper] (ServerService Thread Pool -- 102) HHH000204: Processing PersistenceUnitInfo [
        name: module2-pu
        ...]
      14:35:59,381 INFO [org.jboss.weld.deployer] (MSC service thread 1-4) JBAS016002: Processing weld deployment ejb.jar
      14:35:59,383 INFO [org.jboss.weld.deployer] (MSC service thread 1-4) JBAS016005: Starting Services for CDI deployment: module2.ear
      14:35:59,384 INFO [org.jboss.weld.deployer] (MSC service thread 1-4) JBAS016008: Starting weld service for deployment module2.ear
      14:35:59,394 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service jboss.deployment.subunit."module2.ear"."ejb.jar".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.subunit."module2.ear"."ejb.jar".INSTALL: JBAS018733: Failed to process phase INSTALL of subdeployment "ejb.jar" of deployment "module2.ear"
        at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:166) [wildfly-server-8.2.0.Final.jar:8.2.0.Final]
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_45]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_45]
        at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_45]
      Caused by: java.lang.IllegalStateException: JBAS014666: Duplicate resource module2.ear/ejb.jar#module2-pu
        at org.jboss.as.controller.registry.AbstractModelResource$DefaultResourceProvider.register(AbstractModelResource.java:224)
        at org.jboss.as.controller.registry.AbstractModelResource.registerChild(AbstractModelResource.java:134)
        at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.addManagementConsole(PersistenceUnitServiceHandler.java:1077)
        at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.deployPersistenceUnitPhaseTwo(PersistenceUnitServiceHandler.java:687)
        at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.addPuService(PersistenceUnitServiceHandler.java:280)
        at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.handleJarDeployment(PersistenceUnitServiceHandler.java:153)
        at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.deploy(PersistenceUnitServiceHandler.java:128)
        at org.jboss.as.jpa.processor.PersistenceCompleteInstallProcessor.deploy(PersistenceCompleteInstallProcessor.java:55)
        at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:159) [wildfly-server-8.2.0.Final.jar:8.2.0.Final]
        ... 5 more
      14:35:59,399 WARN [org.jboss.as.jpa] (management-handler-thread - 40) JBAS011411: Unexpected problem gathering statistics: java.lang.IllegalStateException: JBAS011477: Persistence unit 'module2.ear/ejb.jar#module2-pu' is not available
        .... (stacktrace)
      14:35:59,403 WARN [org.jboss.as.jpa] (management-handler-thread - 40) JBAS011411: Unexpected problem gathering statistics: java.lang.IllegalStateException: JBAS011477: Persistence unit 'module2.ear/ejb.jar#module2-pu' is not available
        .... (stacktrace)
      14:35:59,407 WARN [org.jboss.as.jpa] (management-handler-thread - 40) JBAS011411: Unexpected problem gathering statistics: java.lang.IllegalStateException: JBAS011477: Persistence unit 'module2.ear/ejb.jar#module2-pu' is not available
        .... (stacktrace)
      14:35:59,411 WARN [org.jboss.as.jpa] (management-handler-thread - 40) JBAS011411: Unexpected problem gathering statistics: java.lang.IllegalStateException: JBAS011477: Persistence unit 'module2.ear/ejb.jar#module2-pu' is not available
        .... (stacktrace)
      14:35:59,493 INFO [org.jboss.as.server] (management-handler-thread - 44) JBAS018559: Deployed "module1.ear" (runtime-name : "module1.ear")
      14:35:59,493 INFO [org.jboss.as.controller] (management-handler-thread - 44) JBAS014774: Service status report
      JBAS014775: New missing/unsatisfied dependencies:
        service jboss.deployment.subunit."module2.ear"."ejb.jar" (unavailable) dependents: [service jboss.deployment.unit."module2.ear".PARSE]
        service jboss.deployment.subunit."module2.ear"."ejb.jar".STRUCTURE (unavailable) dependents: [service jboss.deployment.unit."module2.ear".PARSE]
        service jboss.deployment.subunit."module2.ear"."ejb.jar".beanmanager (missing) dependents: [service jboss.deployment.subunit."module2.ear"."ejb.jar".weld.weldClassIntrospector]
        service jboss.deployment.subunit."module2.ear"."ejb.jar".deploymentCompleteService (missing) dependents: [service jboss.deployment.unit."module2.ear".deploymentCompleteService]
        service jboss.deployment.subunit."module2.ear"."ejb.jar".jndiDependencyService (missing) dependents: [service jboss.deployment.unit."module2.ear".WeldStartService]
        service jboss.naming.context.java.comp.module2.services.ClientService (missing) dependents: [service jboss.naming.context.java.comp.module2.services.ClientService.ValidatorFactory, service jboss.naming.context.java.comp.module2.services.ClientService.HandleDelegate, service jboss.naming.context.java.comp.module2.services.ClientService.InAppClientContainer, service jboss.naming.context.java.comp.module2.services.ClientService.InstanceName, JBAS014799: ... and 3 more ]
        service jboss.naming.context.java.comp.module2.services.ModuleInitializerService (missing) dependents: [service jboss.naming.context.java.comp.module2.services.ModuleInitializerService.ValidatorFactory, service jboss.naming.context.java.comp.module2.services.ModuleInitializerService.ORB, service jboss.naming.context.java.comp.module2.services.ModuleInitializerService.InstanceName, service jboss.naming.context.java.comp.module2.services.ModuleInitializerService.Validator, JBAS014799: ... and 3 more ]
        service jboss.persistenceunit."module2.ear/ejb.jar#module2-pu" (missing) dependents: [service jboss.deployment.unit."module2.ear".WeldStartService]
      JBAS014776: Newly corrected services:
        service jboss.deployment.unit."module1.ear".deploymentCompleteService (new available)
      JBAS014777: Services which failed to start: service jboss.deployment.subunit."module2.ear"."ejb.jar".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.subunit."module2.ear"."ejb.jar".INSTALL: JBAS018733: Failed to process phase INSTALL of subdeployment "ejb.jar" of deployment "module2.ear"
      
      
      

       

      Message was edited by: jaikiran pai - Edited subject line to note that the issue relates to persistence units.

        • 1. Re: Redeploy dependent ear fails with duplicate resource error for persistence unit
          jaikiran

          Can you please give this a try against 9.0.0.Final which has been released Downloads · WildFly and see if it works there?

          • 2. Re: Redeploy dependent ear fails with duplicate resource error for persistence unit
            felix.mgn

            Nothing changed. That log from Wildlfy 9.0.0.Final:

             

            09:11:31,425 INFO  [org.jboss.as.jpa] (ServerService Thread Pool -- 63) WFLYJPA0011: Stopping Persistence Unit (phase 2 of 2) Service 'module2.ear/ejb.jar#module2-pu'
            09:11:31,426 INFO  [org.jboss.as.jpa] (ServerService Thread Pool -- 63) WFLYJPA0011: Stopping Persistence Unit (phase 1 of 2) Service 'module2.ear/ejb.jar#module2-pu'
            09:11:31,431 INFO  [org.jboss.as.jpa] (ServerService Thread Pool -- 63) WFLYJPA0011: Stopping Persistence Unit (phase 2 of 2) Service 'module1.ear/ejb.jar#module1-pu'
            09:11:31,434 INFO  [org.jboss.as.jpa] (ServerService Thread Pool -- 63) WFLYJPA0011: Stopping Persistence Unit (phase 1 of 2) Service 'module1.ear/ejb.jar#module1-pu'
            09:11:31,437 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) WFLYSRV0208: Stopped subdeployment (runtime-name: ejb.jar) in 17ms
            09:11:31,438 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) WFLYSRV0028: Stopped deployment module1.ear (runtime-name: module1.ear) in 18ms
            09:11:31,495 INFO  [org.jboss.as.server] (management-handler-thread - 3) WFLYSRV0009: Undeployed "module1.ear" (runtime-name: "module1.ear")
            09:11:31,495 INFO  [org.jboss.as.controller] (management-handler-thread - 3) WFLYCTL0183: Service status report
            WFLYCTL0184:    New missing/unsatisfied dependencies:
                  service jboss.deployment.unit."module1.ear".deploymentCompleteService (missing) dependents: [service jboss.deployment.unit."module2.ear".PARSE, service jboss.deployment.subunit."module2.ear"."ejb.jar".PARSE] 
            
            
            09:11:31,558 INFO  [org.jboss.as.repository] (management-handler-thread - 1) WFLYDR0002: Content removed from location /opt/wildfly/standalone/data/content/69/baf0eeab47c006bc1f3d99b21b4355fac62d13/content
            09:11:43,170 INFO  [org.jboss.as.repository] (management-handler-thread - 1) WFLYDR0001: Content added at location /opt/wildfly/standalone/data/content/69/baf0eeab47c006bc1f3d99b21b4355fac62d13/content
            09:11:43,266 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) WFLYSRV0027: Starting deployment of "module1.ear" (runtime-name: "module1.ear")
            09:11:43,268 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) WFLYSRV0207: Starting subdeployment (runtime-name: "ejb.jar")
            09:11:43,273 INFO  [org.jboss.as.jpa] (MSC service thread 1-1) WFLYJPA0002: Read persistence.xml for module1-pu
            09:11:43,289 INFO  [org.jboss.as.jpa] (ServerService Thread Pool -- 63) WFLYJPA0010: Starting Persistence Unit (phase 1 of 2) Service 'module1.ear/ejb.jar#module1-pu'
            09:11:43,289 INFO  [org.hibernate.jpa.internal.util.LogHelper] (ServerService Thread Pool -- 63) HHH000204: Processing PersistenceUnitInfo [
              name: module1-pu
              ...]
            09:11:43,292 INFO  [org.jboss.as.jpa] (ServerService Thread Pool -- 63) WFLYJPA0010: Starting Persistence Unit (phase 2 of 2) Service 'module1.ear/ejb.jar#module1-pu'
            09:11:43,293 INFO  [org.hibernate.dialect.Dialect] (ServerService Thread Pool -- 63) HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
            09:11:43,293 WARN  [org.hibernate.dialect.H2Dialect] (ServerService Thread Pool -- 63) HHH000431: Unable to determine H2 database version, certain features may not work
            09:11:43,294 INFO  [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (ServerService Thread Pool -- 63) HHH000397: Using ASTQueryTranslatorFactory
            09:11:43,296 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) WFLYSRV0070: Deployment restart detected for deployment module2.ear, performing full redeploy instead.
            09:11:43,296 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) WFLYSRV0070: Deployment restart detected for deployment ejb.jar, performing full redeploy instead.
            09:11:43,296 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) WFLYSRV0208: Stopped subdeployment (runtime-name: ejb.jar) in 0ms
            09:11:43,297 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) WFLYSRV0028: Stopped deployment module2.ear (runtime-name: module2.ear) in 1ms
            09:11:43,298 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) WFLYSRV0027: Starting deployment of "module2.ear" (runtime-name: "module2.ear")
            09:11:43,299 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) WFLYSRV0207: Starting subdeployment (runtime-name: "ejb.jar")
            09:11:43,300 INFO  [org.jboss.as.jpa] (MSC service thread 1-2) WFLYJPA0002: Read persistence.xml for module2-pu
            09:11:43,307 INFO  [org.jboss.as.jpa] (ServerService Thread Pool -- 63) WFLYJPA0010: Starting Persistence Unit (phase 1 of 2) Service 'module2.ear/ejb.jar#module2-pu'
            09:11:43,308 INFO  [org.hibernate.jpa.internal.util.LogHelper] (ServerService Thread Pool -- 63) HHH000204: Processing PersistenceUnitInfo [
              name: module2-pu
              ...]
            09:11:43,312 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC000001: Failed to start service jboss.deployment.subunit."module2.ear"."ejb.jar".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.subunit."module2.ear"."ejb.jar".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of subdeployment "ejb.jar" of deployment "module2.ear"
              at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:163)
              at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
              at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
              at java.lang.Thread.run(Thread.java:745)
            Caused by: java.lang.IllegalStateException: WFLYCTL0075: Duplicate resource module2.ear/ejb.jar#module2-pu
              at org.jboss.as.controller.registry.AbstractModelResource$DefaultResourceProvider.register(AbstractModelResource.java:248)
              at org.jboss.as.controller.registry.AbstractModelResource.registerChild(AbstractModelResource.java:143)
              at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.addManagementConsole(PersistenceUnitServiceHandler.java:1128)
              at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.deployPersistenceUnitPhaseTwo(PersistenceUnitServiceHandler.java:704)
              at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.addPuService(PersistenceUnitServiceHandler.java:289)
              at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.handleJarDeployment(PersistenceUnitServiceHandler.java:162)
              at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.deploy(PersistenceUnitServiceHandler.java:133)
              at org.jboss.as.jpa.processor.PersistenceCompleteInstallProcessor.deploy(PersistenceCompleteInstallProcessor.java:55)
              at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:156)
              ... 5 more
            
            
            09:11:43,376 INFO  [org.jboss.as.server] (management-handler-thread - 2) WFLYSRV0010: Deployed "module1.ear" (runtime-name : "module1.ear")
            09:11:43,376 INFO  [org.jboss.as.controller] (management-handler-thread - 2) WFLYCTL0183: Service status report
            WFLYCTL0184:    New missing/unsatisfied dependencies:
                  service jboss.deployment.subunit."module2.ear"."ejb.jar" (unavailable) dependents: [service jboss.deployment.unit."module2.ear".PARSE] 
                  service jboss.deployment.subunit."module2.ear"."ejb.jar".STRUCTURE (unavailable) dependents: [service jboss.deployment.unit."module2.ear".PARSE] 
                  service jboss.deployment.subunit."module2.ear"."ejb.jar".deploymentCompleteService (missing) dependents: [service jboss.deployment.unit."module2.ear".deploymentCompleteService] 
            WFLYCTL0185:    Newly corrected services:
                  service jboss.deployment.unit."module1.ear".deploymentCompleteService (new available)
            WFLYCTL0186:   Services which failed to start:      service jboss.deployment.subunit."module2.ear"."ejb.jar".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.subunit."module2.ear"."ejb.jar".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of subdeployment "ejb.jar" of deployment "module2.ear"
            
            • 3. Re: Redeploy dependent ear fails with duplicate resource error for persistence unit
              jaikiran

              This looks like a bug. Please file a JIRA for it here WildFly - JBoss Issue Tracker and add relevant details.

              • 4. Re: Redeploy dependent ear fails with duplicate resource error for persistence unit
                smarlow

                If I understand this correctly from the WFLY-4908 wording, module2.ear depends on module1.ear but module2.ear isn't restarted when module1.ear is.  I think that this has been a problem with inter-deployment dependencies.  I think that module2.ear needs to have service dependencies on module1.ear but I'm not sure how that should be accomplished.

                • 5. Re: Redeploy dependent ear fails with duplicate resource error for persistence unit
                  felix.mgn

                  You understood correctly. But this problem only with persistence unit. If I remove presistence.xml from model2.ear, all work correctly(module2.ear automaticaly restart). In current configuration (with persistence.xml) log contains information, about stopping module2 persistence unit:

                  09:11:31,425 INFO  [org.jboss.as.jpa] (ServerService Thread Pool -- 63) WFLYJPA0011: Stopping Persistence Unit (phase 2 of 2) Service 'module2.ear/ejb.jar#module2-pu'
                  09:11:31,426 INFO  [org.jboss.as.jpa] (ServerService Thread Pool -- 63) WFLYJPA0011: Stopping Persistence Unit (phase 1 of 2) Service 'module2.ear/ejb.jar#module2-pu'
                  

                  but when module2 restaring:

                  09:11:43,296 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) WFLYSRV0070: Deployment restart detected for deployment module2.ear, performing full redeploy instead.  
                  09:11:43,296 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) WFLYSRV0070: Deployment restart detected for deployment ejb.jar, performing full redeploy instead.  
                  

                  persistence unit start with error "duplicate resource"