2 Replies Latest reply on Mar 10, 2009 3:54 PM by Wolfgang Knauf

    service.xml in EJB-jar raises InstanceAlreadyExistsException

    Wolfgang Knauf Master

      This is a crosspost from the EJB3 forum (http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4205688 , jaikiran pointed me to here).

      I have an EAR with EJB jar and AppClient jar. The EJB jar contains a MDB, and the Queue for it is declared as a "...-service.xml" file.

      I found that depending on the location of the ...-service.xml, the service is started twice on deploy.

      If it is placed in EJB jar\META-INF, everything is fine. If the file is placed in the EJB jar root, I see this exception on deploy:

      23:00:08,484 WARN [AbstractDeploymentContext] Unable to register deployment mbean vfszip:/C:/temp/jboss-5.0.0.GA/server/default/deploy/Message.ear/MessageEJB.jar/knaufmq-service.xml
      javax.management.InstanceAlreadyExistsException: jboss.deployment:id="vfszip:/C:/temp/jboss-5.0.0.GA/server/default/deploy/Message.ear/MessageEJB.jar/knaufmq-service.xml",type=SubDeployment already registered.
       at org.jboss.mx.server.registry.BasicMBeanRegistry.add(BasicMBeanRegistry.java:767)
       at org.jboss.mx.server.registry.BasicMBeanRegistry.registerMBean(BasicMBeanRegistry.java:236)
       at sun.reflect.GeneratedMethodAccessor89.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
       at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:138)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:90)
       at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:140)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:90)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
       at org.jboss.mx.server.MBeanServerImpl$3.run(MBeanServerImpl.java:1431)
       at java.security.AccessController.doPrivileged(Native Method)
       at org.jboss.mx.server.MBeanServerImpl.registerMBean(MBeanServerImpl.java:1426)
       at org.jboss.mx.server.MBeanServerImpl.registerMBean(MBeanServerImpl.java:376)
       at org.jboss.deployers.structure.spi.helpers.AbstractDeploymentContext.registerMBeans(AbstractDeploymentContext.java:989)
       at org.jboss.deployers.structure.spi.helpers.AbstractDeploymentContext.registerMBeans(AbstractDeploymentContext.java:998)
       at org.jboss.deployers.structure.spi.helpers.AbstractDeploymentContext.registerMBeans(AbstractDeploymentContext.java:998)
       at org.jboss.deployers.structure.spi.helpers.AbstractDeploymentContext.postRegister(AbstractDeploymentContext.java:964)
       at org.jboss.mx.server.AbstractMBeanInvoker.invokePostRegister(AbstractMBeanInvoker.java:974)
       at org.jboss.mx.server.AbstractMBeanInvoker.postRegister(AbstractMBeanInvoker.java:681)
       at org.jboss.mx.server.registry.BasicMBeanRegistry.registerMBean(BasicMBeanRegistry.java:338)
       at sun.reflect.GeneratedMethodAccessor89.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
       at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:138)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:90)
       at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:140)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:90)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
       at org.jboss.mx.server.MBeanServerImpl$3.run(MBeanServerImpl.java:1431)
       at java.security.AccessController.doPrivileged(Native Method)
       at org.jboss.mx.server.MBeanServerImpl.registerMBean(MBeanServerImpl.java:1426)
       at org.jboss.mx.server.MBeanServerImpl.registerMBean(MBeanServerImpl.java:376)
       at org.jboss.deployers.plugins.deployers.DeployersImpl.registerMBean(DeployersImpl.java:1602)
       at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:755)
       at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:545)
       at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:290)
       at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:221)
       at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
       at java.util.concurrent.FutureTask$Sync.innerRunAndReset(Unknown Source)
       at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(Unknown Source)
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(Unknown Source)
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
       at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
       at java.lang.Thread.run(Unknown Source)



      The MDB works fine anyway. So this exception seems to be a "false positive".

      A sample is here: http://www.informatik.fh-wiesbaden.de/~knauf/private/mdb/service/
      The EAR is the sample, the batch might be used to start the client after deploying the EAR. The client itself just sends the input in the textfield to the MDB queue.

      Is this an error in JBoss? Should it raise a deployment failure if a ...-service.xml is placed in the jar root?

      Thanks

      Wolfgang