Hi,

I have a problem with 2 wars (a.war and b.war), which have the persistence jar with persistence.xml. The persistence xml for both jars has persistence unit with same name
<persistence-unit name="default"… (The Datasource for each persistence unit aren’t the same). But if I deploy on the JBOSS AS 5.1.0 the both war, only the first war deploy on the second I have a problem (Exception):

 

2010-10-01 09:51:26,477 ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] (main) Error installing to Real: name=vfszip:/usr/local/jboss-5.1.0.GA-jdk5/server/rb_std_dev/deploy/b.war
/ state=PreReal mode=Manual requiredState=Real
org.jboss.deployers.spi.DeploymentException: Error deploying: persistence.unit:unitName=#default
        at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49)
        at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:125)
        at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:51)
        at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
        at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
        at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
        at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
        at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)
        at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1178)
        at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
        at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
 
In SPEC for EJB 3.0 I have read:
 
6.2.2 Persistence Unit Scope
 

When referencing a persistence unit using the unitName annotation element or persistence-
unit-name deployment descriptor element, the visibility scope of the persistence unit is
determined by its point of definition. A persistence unit that is defined at the level of an EJB-JAR,WAR,
or application client jar is scoped to that EJB-JAR, WAR, or application jar respectively and is visible to
the components defined in that jar or war…”
 
What is wrong?