3 Replies Latest reply on Nov 26, 2019 9:25 AM by Mohan SR

    JNDI alias for ejb module name

    Claus Anderwald Newbie

      Hi,

       

      after the migration of a JBoss 7.1.3 application to WildFly 10.1, some ejb module names have changed. The JNDI lookups of the new remote clients are working without any problems. But there exist some legacy remote clients that are still using the old ejb module name for the JNDI lookup.

       

      Example:

      The jar / ejb module name has changed from wildfly-sandbox-ejb to wildfly-sandbox-ejb-new.

       

      Deployed EJB at WildFly startup:

      12:45:55,795 INFO  [org.jboss.as.ejb3.deployment] (MSC service thread 1-2) WFLYEJB0473: JNDI bindings for session bean named 'SampleBeanRemoteImpl' in deployment unit 'subdeployment "wildfly-sandbox-ejb-new.jar" of deployment "wildfly-sandbox.ear"' are as follows:

        java:global/wildfly-sandbox/wildfly-sandbox-ejb-new/SampleBeanRemoteImpl!de.gebit.dst.jboss.api.SampleBeanRemote

        java:app/wildfly-sandbox-ejb-new/SampleBeanRemoteImpl!de.gebit.dst.jboss.api.SampleBeanRemote

        java:module/SampleBeanRemoteImpl!de.gebit.dst.jboss.api.SampleBeanRemote

        java:jboss/exported/wildfly-sandbox/wildfly-sandbox-ejb-new/SampleBeanRemoteImpl!de.gebit.dst.jboss.api.SampleBeanRemote

        java:global/wildfly-sandbox/wildfly-sandbox-ejb-new/SampleBeanRemoteImpl

        java:app/wildfly-sandbox-ejb-new/SampleBeanRemoteImpl

        java:module/SampleBeanRemoteImpl

       

      JNDI lookup string of the new remote Client:

      ejb:wildfly-sandbox/wildfly-sandbox-ejb-new/SampleBeanRemoteImpl!de.gebit.dst.jboss.api.SampleBeanRemote

       

      JNDI lookup string of the old remote Client:

      ejb:wildfly-sandbox/wildfly-sandbox-ejb/SampleBeanRemoteImpl!de.gebit.dst.jboss.api.SampleBeanRemote

       

      Not really a surprise - the lookup of the old client doesn't work. The bean itself and the code haven't changed, it is just a lookup problem. Is there any way to define an alias for the ejb module names? I tried to solve this problem with JNDI name alias in the naming module, e.g.

      <lookup name="java:jboss/exported/wildfly-sandbox/wildfly-sandbox-ejb/SampleBeanRemoteImpl!de.gebit.dst.jboss.api.SampleBeanRemote" lookup="java:jboss/exported/wildfly-sandbox/wildfly-sandbox-ejb-new/SampleBeanRemoteImpl!de.gebit.dst.jboss.api.SampleBeanRemote"/>

      but it doesn't work. Any idea?

       

       

      Regards

       

      Claus

        • 1. Re: JNDI alias for ejb module name
          Jaikiran Pai Master

          In the META-INF/ejb-jar.xml of the EJB jar there's a <module-name> element which you can use to set a (static) name for the EJB module, which will then be used for the JNDI bindings. Take a look at the ejb-jar XSD for more details.

          • 2. Re: JNDI alias for ejb module name
            Claus Anderwald Newbie

            In the ejb-jar.xml I can change the module name to the old value (same effect as renaming the ejb jar in the ear file), but this will change the lookup path for the migrated application, too. I do not want to change the lookup path back to wildfly-sandbox-ejb, I just need an temporary additional alias. This alias will be removed after all old clients have been updated to a new version.

            • 3. Re: JNDI alias for ejb module name
              Mohan SR Newbie

              I know its pretty old thread, but will be useful for some still lookin for this.

               

              You need to use, <lookup name="java:global/exported/wildfly-sandbox/wildfly-sandbox-ejb/SampleBeanRemoteImpl!de.gebit.dst.jboss.api.SampleBeanRemote" lookup="java:jboss/exported/wildfly-sandbox/wildfly-sandbox-ejb-new/SampleBeanRemoteImpl!de.gebit.dst.jboss.api.SampleBeanRemote"/>