Is it possible to configure JBoss to install multiple persistence units with the same name that are scoped to different web applications?

Solution Verified - Updated -

Issue

  • Two war files have the same JPA persistence unit named "drift" deployed in their WEB-INF/lib directory.  When these war files are deployed to the same JBoss instance the following exception is thrown.
        Unable to register deployment mbean org.jboss.metadata.jpa.spec.PersistenceUnitMetaData.drift
        javax.management.InstanceAlreadyExistsException: jboss.deployment:id="org.jboss.metadata.jpa.spec.PersistenceUnitMetaData.drift",type=Component already registered.
             at org.jboss.mx.server.registry.BasicMBeanRegistry.add(BasicMBeanRegistry.java:756)
             at org.jboss.mx.server.registry.BasicMBeanRegistry.registerMBean(BasicMBeanRegistry.java:233)
             at sun.reflect.GeneratedMethodAccessor75.invoke(Unknown Source)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
             at java.lang.reflect.Method.invoke(Method.java:597)
        ...
  • Is it possible to configure JBoss to install multiple persistence units with the same name that are scoped to different web applications? 

Environment

  • JBoss Enterprise Application Platform(EAP) 5

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content