10 Replies Latest reply on Apr 17, 2012 10:30 AM by massios

    Ear sufix in ejb jndi name

    mireksz

      Hello,

      I have problem with ejb jndi name. When I deploy my ear with sessions ejb(with annotations @Remote, @Stateless). The all names have ear name sufix for example

       

      test/SimplService

       

      But when I deploy the same ear but without annotation only with ejb-jar.xml then ejb names there aren't the same. Dosent start with ear sufix

       

      Why?

       

      Best regards

        • 2. Re: Ear sufix in ejb jndi name
          mireksz

          I using

           

          jboss.xml

           

          <?xml version="1.0" encoding="UTF-8"?>
          <!DOCTYPE jboss PUBLIC
                "-//JBoss//DTD JBOSS 3.0//EN"
                "http://www.jboss.org/j2ee/dtd/jboss_3_0.dtd">
          <jboss>
              <enterprise-beans>
                  <session>
                      <ejb-name>AsenDaoImpl</ejb-name>
                      <local-jndi-name>ewan/AsenDaoImpl/local</local-jndi-name>
                  </session>
              </enterprise-beans>
          </jboss>

           

          and I have two entires in JNDI

           

          1) ewan/AsenDaoImpl/local

          2) AsenDaoImpl/local

           

          I don't know why the second entry exists

          • 3. Re: Ear sufix in ejb jndi name
            jaikiran

            Which version of JBoss AS are you using? Can you post the console logs when your application is deploying?

            • 4. Re: Ear sufix in ejb jndi name
              mireksz

              JBOSS 5.0.0 GA

              log


              14:37:42,425 INFO  [JBossASKernel] Created KernelDeployment for: server-ewan-application-1.0.0-SNAPSHOT.ear
              14:37:42,430 INFO  [JBossASKernel] installing bean: jboss.j2ee:ear=server-ewan-application-1.0.0-SNAPSHOT.ear,jar=server-ewan-application-1.0.0-SNAPSHOT.ear,name=AsenDaoImpl,service=EJB3
              14:37:42,431 INFO  [JBossASKernel]   with dependencies:
              14:37:42,431 INFO  [JBossASKernel]   and demands:
              14:37:42,431 INFO  [JBossASKernel]     jboss.ejb:service=EJBTimerService
              14:37:42,431 INFO  [JBossASKernel]   and supplies:
              14:37:42,431 INFO  [JBossASKernel]     jndi:AsenDaoImpl/local
              14:37:42,431 INFO  [JBossASKernel]     Class:asen.server.dao.AsenDao
              14:37:42,431 INFO  [JBossASKernel]     jndi:AsenDaoImpl/local-asen.server.dao.AsenDao
              14:37:42,431 INFO  [JBossASKernel]     jndi:ewan/AsenDaoImpl/local
              14:37:42,432 INFO  [JBossASKernel] Added bean(jboss.j2ee:ear=server-ewan-application-1.0.0-SNAPSHOT.ear,jar=server-ewan-application-1.0.0-SNAPSHOT.ear,name=AsenDaoImpl,service=EJB3) to KernelDeployment of: server-ewan-application-1.0.0-SNAPSHOT.ear
              14:37:42,659 INFO  [SessionSpecContainer] Starting jboss.j2ee:ear=server-ewan-application-1.0.0-SNAPSHOT.ear,jar=server-ewan-application-1.0.0-SNAPSHOT.ear,name=AsenDaoImpl,service=EJB3
              14:37:42,667 INFO  [EJBContainer] STARTED EJB: pl.com.stream.lib.asen.server.dao.AsenDaoImpl ejbName: AsenDaoImpl
              14:37:42,694 INFO  [JndiSessionRegistrarBase] Binding the following Entries in Global JNDI:

                  ewan/AsenDaoImpl/local - EJB3.x Default Local Business Interface
                  AsenDaoImpl/local-asen.server.dao.AsenDao - EJB3.x Local Business Interface

              • 5. Re: Ear sufix in ejb jndi name
                jaikiran
                Are you talking about this one:

                MirekSz wrote:

                 


                    AsenDaoImpl/local-asen.server.dao.AsenDao - EJB3.x Local Business Interface

                That binding we use internally during injection for business interface specific proxies. You need not use that jndi name for lookup. You can instead use ewan/AsenDaoImpl/local

                • 6. Re: Ear sufix in ejb jndi name
                  mireksz

                  Ok,

                  but when I deploy two ear files with serviceName AsenDaoImpl and I set diferent prefix(ewan/AsenDaoImpl/local;next/AsenDaoImpl/local) then jboss throw my an exception that AsenDaoImpl/local is already register

                  • 7. Re: Ear sufix in ejb jndi name
                    skerstetter

                    Did you ever resolve this?  I'm having a similar problem when using the default names.  When deploying the ejbs in different ears, the ear file name is supposed to be pre-pended to the JNDI name, which ought to make the names unique, but I also get the "name already bound" issue.  Even worse, at runtime, the ejbs cannot be injected because of a "not found" error.

                    • 8. Re: Ear sufix in ejb jndi name
                      mireksz

                      Yes,

                      I discover that when I have ejb-jar.xml in META-INF of ear I have ejbs names without ear prefix but when I put ejb-jar .xml into one of my jars inside ear I have ear prefix

                      • 9. Re: Ear sufix in ejb jndi name
                        skerstetter

                        OK, yes.  I had to do something similar.  Both of my ear files had all of the ejb-jars deployed from the lib directory.  Moving all of the ejb-jars in one of them to the root of the ear file resolved the issue.

                        • 10. Re: Ear sufix in ejb jndi name
                          massios

                          I tried the suggestion of Shawn and of Mirek and it did not work. I have an JBoss 5.1 EAP.