3 Replies Latest reply on Jun 19, 2009 4:04 AM by wolfc

    Unique JNDI Names

    alrubinger

      @see https://jira.jboss.org/jira/browse/JBPAPP-2124

      I'm constructing a (supposedly) unique String from the same formula we use for JNDI Names:

      [earName-]ejbName

      But as this shows, error in deployment when 2 EJBs in different JARs in an EAR share an ejb-name. At first I thought the deployment itself was illegal, but found this:

      "EJB 3.0 Core Spec ejb-jar XSD Page 498" wrote:
      The ejb-name element contains the name of an enterprise bean. The name must be unique within the ejb-jar file.


      Have we been wrong in this all along? Looks like non-unique EJB names are legal so long as they're in different JARs.

      S,
      ALR


        • 1. Re: Unique JNDI Names
          starksm64

          Yes, the ejb-name has always only been required to be unique within a jar.

          • 2. Re: Unique JNDI Names
            jaikiran

             

            "ALRubinger" wrote:

            Have we been wrong in this all along? Looks like non-unique EJB names are legal so long as they're in different JARs.



            Yeah, although i did start a discussion about this a few months back in our user forum, i never pushed it to a logical end http://www.jboss.org/index.html?module=bb&op=viewtopic&t=143237

            "ALRubinger" wrote:

            @see https://jira.jboss.org/jira/browse/JBPAPP-2124

            That exception shows:


            16:22:33,539 WARN [AbstractDeploymentContext] Unable to register deployment mbean refspath.ear-EJB-metrics-instance
            javax.management.InstanceAlreadyExistsException: jboss.deployment:id="refspath.ear-EJB-metrics-instance",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)
            Caused by:
            java.lang.IllegalStateException: refspath.ear-EJB-metrics-instance is already installed.
            at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:716)
            at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:540)
            at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:121)
            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 <unknown class>.<unknown method>(Unknown Source)
            ... 26 more
            16:22:34,265 WARN [HDScanner] Failed to process changes


            which actually is a MC thing and our lack of understanding/control of what a component name's scope is http://www.jboss.org/index.html?module=bb&op=viewtopic&t=154305

            And furthermore, the MBean that MC is trying to register:

            jboss.deployment:id="refspath.ear-EJB-metrics-instance",type=Component


            is an debug level MBean which is now disabled by default in AS trunk https://jira.jboss.org/jira/browse/JBAS-6987. Probably we need to do this in EAP branch (and maybe AS 5_x branch) too?

            However, the real solution for JNDI names would be to fix our default JNDI naming scheme (and still be backward compatible).


            • 3. Re: Unique JNDI Names
              wolfc

              We've been here before http://www.jboss.org/index.html?module=bb&op=viewtopic&t=144173.

              Proceed on EJBTHREE-1794 taking the new jndibinder component into account (http://www.jboss.org/index.html?module=bb&op=viewtopic&t=153079).