• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

InstanceAlreadyExistsException when deploying multiple versions of the same ear

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'd like to use one instance of JBoss AS (5.1.GA) to run a demo version, qa version, and dev version of our application which is being deployed as an EAR. Because each ear is using the same persistence unit name, I get the following warnings and error when deploying the second ear:

WARN [AbstractDeploymentContext] Unable to register deployment mbean org.jboss.metadata.jpa.spec.PersistenceUnitMetaData.xxx
javax.management.InstanceAlreadyExistsException: jboss.deployment:id="org.jboss.metadata.jpa.spec.PersistenceUnitMetaData.xxx",type=Component already registered.

WARN [AbstractDeploymentContext] Unable to register deployment mbean jboss.jca:name=xxxDS,service=ManagedConnectionFactory
javax.management.InstanceAlreadyExistsException: jboss.deployment:id="jboss.jca:name=xxxDS,service=ManagedConnectionFactory",type=Component already registered.

WARN [AbstractDeploymentContext] Unable to register deployment mbean jboss.jca:name=xxxDS,service=ManagedConnectionPool
javax.management.InstanceAlreadyExistsException: jboss.deployment:id="jboss.jca:name=xxxDS,service=ManagedConnectionPool",type=Component already registered.

WARN [AbstractDeploymentContext] Unable to register deployment mbean jboss.jca:name=xxxDS,service=LocalTxCM
javax.management.InstanceAlreadyExistsException: jboss.deployment:id="jboss.jca:name=xxxDS,service=LocalTxCM",type=Component already registered.

WARN [AbstractDeploymentContext] Unable to register deployment mbean jboss.jca:name=xxxDS,service=DataSourceBinding
javax.management.InstanceAlreadyExistsException: jboss.deployment:id="jboss.jca:name=xxxDS,service=DataSourceBinding",type=Component already registered.

ERROR [AbstractKernelController] Error installing to Real: name=vfszip:.../deploy/xxx-0.1.0.ear/ state=PreReal mode=Manual requiredState=Real
org.jboss.deployers.spi.DeploymentException: Error deploying: jboss.jca:service=ManagedConnectionFactory,name=xxxDS

vfszip:.../deploy/xxx-0.1.0.ear/ -> org.jboss.deployers.spi.DeploymentException: Error deploying: jboss.jca:service=ManagedConnectionFactory,name=xxxDS
DEPLOYMENTS IN ERROR:
Deployment "vfszip:.../deploy/xxx-0.1.0.ear/" is in error due to the following reason(s): java.lang.IllegalStateException: jboss.jca:name=xxxDS,service=ManagedConnectionFactory is already installed.

At that point, the second ear is undeployed by JBoss.

Shouldn't the persistence units be local to each ear instead of globally defined within the JBoss container?
Is there a fix for this issue?
Is there a different workaround then having to define unique persistence units and changing the code in each ear to refer to the distinct name?
An example:
@PersistenceContext(unitName = "xxx")
private EntityManager em;
I'd have to change this in every session bean to refer to the unique name for the particular ear being deployed.

Any help here would be greatly appreciated.

Dan


 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can ignore the WARN messages. See the comments in this JIRA https://jira.jboss.org/jira/browse/JBAS-6821 for details.


vfszip:.../deploy/xxx-0.1.0.ear/ -> org.jboss.deployers.spi.DeploymentException: Error deploying: jboss.jca:service=ManagedConnectionFactory,name=xxxDS
DEPLOYMENTS IN ERROR:
Deployment "vfszip:.../deploy/xxx-0.1.0.ear/" is in error due to the following reason(s): java.lang.IllegalStateException: jboss.jca:name=xxxDS,service=ManagedConnectionFactory is already installed.



As for the error message, it appears that you are deploying the same datasource in multiple .ear files. Is that right?


 
Dan Seaver
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, I am deploying the same datasource in both ears.
 
Dan Seaver
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jaikiran,
Thanks for the pointer on the warning messages. In JBOSS_HOME/server/< servername>/conf/bootstrap/deployers.xml, I commented out the @JMX annotation for the DeployersImpl bean (second line below) and the warning messages are gone:

<bean name="Deployers" class="org.jboss.deployers.plugins.deployers.DeployersImpl">
<!--<annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.deployment:service=DeployersImpl", exposedInterface=org.jboss.deployers.plugins.deployers.DeployersImplMBean.class, registerDirectly=true)</annotation>-->
<constructor><parameter><inject bean="jboss.kernel:service=KernelController"/></parameter></constructor>
<!-- Accept any implementor of deployer -->
<incallback method="addDeployer"/>
<uncallback method="removeDeployer"/>
<property name="mgtObjectCreator"><inject bean="ManagedObjectCreator"/></property>
</bean>

On a similar issue as the datasource issue, I'm deploying the same MBean in both ears as well. Can these be scoped to each ear as well? Right now I get the following error when the second ear attempts to deploy:

ERROR [AbstractKernelController] Error installing to Create: name=jboss.j2ee:ear=xxx.ear,jar=xxx.jar,name=ApplicationSettings,service=EJB3 state=Configured
java.lang.RuntimeException: Problem registering @Management interface for @Service class xxx.impl.ApplicationSettings
at org.jboss.ejb3.service.ServiceContainer.registerManagementInterface(ServiceContainer.java:794)...

Dan
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Dan Seaver wrote:
On a similar issue as the datasource issue, I'm deploying the same MBean in both ears as well. Can these be scoped to each ear as well?



The MBeans and the datasources are not scoped per application. The MBeans are deployed to the MBeanServer and registered using the "name" attribute that you specify for the MBean. That has to be unique per server. So you can't have 2 applications deploying the same MBean with the same name.

As for the datasources, JBoss creates MBean out of those datasources and uses the "jndiname" to create the MBean name out of it. Additionally, it also binds the datasource to the JNDI and uses the "jndiname" as the key. As such, you will have to have unique JNDI names for those datasources.
 
Dan Seaver
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Drat!

Thanks for your insight.

Dan
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic