5 Replies Latest reply on Jul 15, 2002 6:33 AM by panosk

    How to deploy an ejb several times?

    panosk

      I want to deploy an ejb to several J2EE applications to JBoss 3.0
      In each application the ejb has different settings (eg different datasource)
      I make multiple ear files with different names and i gave the bean different jndi names.

      It seems that jboss uses the same JMX name for all ejbs that's why i get the following error:

      javax.management.InstanceAlreadyExistsException: jboss.j2ee:service=EJB,jndiName=PermissionBean already registered.
      at org.jboss.mx.server.registry.BasicMBeanRegistry.add(BasicMBeanRegistry.java:654)
      at org.jboss.mx.server.registry.BasicMBeanRegistry.registerMBean(BasicMBeanRegistry.java:240)
      at org.jboss.mx.server.MBeanServerImpl.registerMBean(MBeanServerImpl.java:949)
      at org.jboss.mx.server.MBeanServerImpl.registerMBean(MBeanServerImpl.java:276)
      at org.jboss.ejb.EjbModule.createService(EjbModule.java:389)
      at org.jboss.system.ServiceMBeanSupport.create(ServiceMBeanSupport.java:134)
      at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:894)
      at $Proxy6.create(Unknown Source)
      at org.jboss.system.ServiceController.create(ServiceController.java:272)
      at org.jboss.system.ServiceController.create(ServiceController.java:212)
      at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:491)
      at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
      at $Proxy5.create(Unknown Source)
      at org.jboss.ejb.EJBDeployer.create(EJBDeployer.java:380)

      How can i solve this problem? any suggestions?


        • 1. Re: How to deploy an ejb several times?
          schaefera

          Which version of JBoss are you using because I checked JBoss 3.0.0 and could not see your problem.

          Andy

          • 2. Re: How to deploy an ejb several times?
            crackers

            You have to name the bean differently (both <ejb-name> and <jndi-name> for each "application" that you deploy the bean in. Since you're using different data sources, then you already have different descriptor files, so this should actually be trivial.

            • 3. Re: How to deploy an ejb several times?
              panosk

              I have allready changed the jndi names and datasource references in jboss.xml but changing the ejb-name means changing ejb-jar.xml also and i would like to avoid it.
              I thing that there should be a way to define jmx name in jboss.xml because it's jboss specific.

              • 4. Re: How to deploy an ejb several times?
                panosk

                I am using JBoss 3.0.
                My problem happens when i deploy the same application two times.
                I only change jboss.xml and jbosscmp-jdbc.xml and application.xml to map the different datasources and different jndi names and context root.

                • 5. Re: How to deploy an ejb several times?
                  panosk

                  I found out what was causing the problem.
                  I had to define jndi-name in jboss.xml even for entity beans that i expose only locally.
                  Jboss uses jndi-name to generate the jmx name and if jndi-name doesn't exist it uses the bean's name.