2 Replies Latest reply on Oct 29, 2010 9:32 AM by llraj

    can I use same persistence unit name in multiple wars?

    llraj

      I have 2 wars that use the same PU name in their respective persistence.xml. This works in Glassfish v2.1.1 and v3 however I get a component already exists error in JBoss 5.1.0GA

       

      The first war is deployed successfully but the second war fails deployment with below error,

       

      2010-10-29 08:53:29,916 WARN  [org.jboss.deployers.structure.spi.helpers.AbstractDeploymentContext] (main) Unable to register deployment mbean org.jboss.metadata.jpa.spec.PersistenceUnitMetaData.commonPUName
      javax.management.InstanceAlreadyExistsException: jboss.deployment:id="org.jboss.metadata.jpa.spec.PersistenceUnitMetaData.commonPUName",type=Component already registered.

       

      ...

       

      2010-10-29 08:53:29,994 ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] (main) Error installing to Real: name=vfsfile:/C:/jboss/jboss-5.1.0.GA/server/default/deploy/second.war/ state=PreReal mode=Manual requiredState=Real
      org.jboss.deployers.spi.DeploymentException: Error deploying: persistence.unit:unitName=#commonPUName

       

      ...

       

      Caused by: java.lang.IllegalStateException: persistence.unit:unitName=#commonPUName is already installed.

       

      ...

       

      DEPLOYMENTS IN ERROR:
        Deployment "vfsfile:/C:/jboss/jboss-5.1.0.GA/server/default/deploy/second.war/" is in error due to the following reason(s): java.lang.IllegalStateException: persistence.unit:unitName=#commonPUName is already installed.