5 Replies Latest reply on Dec 28, 2010 8:47 PM by newguy2010

    JNDI lookup issue - EJB not bound

    gurmat

      Hi All,

      I am new to Jboss...We are migrating from WAS4 to JBoss4.3 and are running into issues for EJB.

      For all the EJBs, it is giving below exception:

       

      2010-12-17 09:52:29,008 ERROR [STDERR] javax.naming.NameNotFoundException: ejb not bound
      2010-12-17 09:52:29,009 ERROR [STDERR]  at org.jnp.server.NamingServer.getBinding(NamingServer.java:581)
      2010-12-17 09:52:29,009 ERROR [STDERR]  at org.jnp.server.NamingServer.getBinding(NamingServer.java:589)
      2010-12-17 09:52:29,009 ERROR [STDERR]  at org.jnp.server.NamingServer.getObject(NamingServer.java:595)
      2010-12-17 09:52:29,009 ERROR [STDERR]  at org.jnp.server.NamingServer.lookup(NamingServer.java:313)
      2010-12-17 09:52:29,009 ERROR [STDERR]  at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:667)
      2010-12-17 09:52:29,009 ERROR [STDERR]  at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
      2010-12-17 09:52:29,009 ERROR [STDERR]  at javax.naming.InitialContext.lookup(InitialContext.java:351)

       

      Below is the JNDI look up code

       

      InitialContext ic =

      new InitialContext();

      VendorOSTrackingHome home = (VendorOSTrackingHome) ic.lookup(

      "ejb/BulkLoaderApp/VendorOsTracking");

       

      JBoss-web.xml

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

      <?

       

       

      xml version="1.0" encoding="UTF-8"

      ?>

      <

       

       

      jboss-web

      >

       

       

       

       

       

       

       

      <

       

       

      ejb-ref

      >

       

       

      <ejb-ref-name>ejb/BulkLoaderApp/VendorOsTracking</ejb-ref-name

      >

       

       

      <ejb-link>VendorOsTrackingEJB.jar#VendorOsTracking</ejb-link

      >

       

       

      <jndi-name>VendorOsTracking</jndi-name

      >

      </

       

       

      ejb-ref

      >

       

      </

       

       

      jboss-web

      >

       

      +- UserTransaction[link -> UserTransaction] (class: javax.naming.LinkRef)
        +- env (class: org.jnp.interfaces.NamingContext)
        |   +- jdbc (class: org.jnp.interfaces.NamingContext)
        |   |   +- Profile[link -> java:Profile] (class: javax.naming.LinkRef)
        |   +- ejb (class: org.jnp.interfaces.NamingContext)
        |   |   +- BulkLoaderApp (class: org.jnp.interfaces.NamingContext)
        |   |   |   +- VendorOsTracking[link -> VendorOsTracking] (class: javax.naming.LinkRef)
        |   +- security (class: org.jnp.interfaces.NamingContext)
        |   |   +- realmMapping[link -> java:/jaas/customRealm] (class: javax.naming.LinkRef)
        |   |   +- subject[link -> java:/jaas/customRealm/subject] (class: javax.naming.LinkRef)
        |   |   +- securityMgr[link -> java:/jaas/customRealm] (class: javax.naming.LinkRef)
        |   |   +- security-domain[link -> java:/jaas/customRealm] (class: javax.naming.LinkRef)

      I am really stuck on this...Can anyone please help us out in this??

       

      Thanks,

      Gurmat

       

       

       

        • 1. Re: JNDI lookup issue - EJB not bound
          wdfink

          What EJB version do you use?

          Do you see that the EJB application is correct deployed and you see it in the jmx-console?

          • 2. Re: JNDI lookup issue - EJB not bound
            welle

            You can use the jmx console to browse the jndi tree so you can verify that the EJB is bound correcly: http://docs.jboss.org/jbossas/docs/Server_Configuration_Guide/4/html/Additional_Naming_MBeans-The_org.jboss.naming.JNDIView_MBean.html

            • 3. Re: JNDI lookup issue - EJB not bound
              gurmat

              Thanks Anders / Wolf-Dieter for your response!!

              The EJB version we are using is 1.0.

              One thing I noted in JMX console in JMX MBean Operation Result list() is that I am not finding reference of those EJBs under EJB module and Global JNDI name...

               

               

              Web Applications

              +- UserTransaction[link -> UserTransaction] (class: javax.naming.LinkRef)
                +- env (class: org.jnp.interfaces.NamingContext)
                |   +- jdbc (class: org.jnp.interfaces.NamingContext)
                |   |   +- Profile[link -> java:Profile] (class: javax.naming.LinkRef)
                |   +- ejb (class: org.jnp.interfaces.NamingContext)
                |   |   +- BulkLoaderApp (class: org.jnp.interfaces.NamingContext)
                |   |   |   +- VendorOsTracking[link -> VendorOsTracking] (class: javax.naming.LinkRef)
                |   +- security (class: org.jnp.interfaces.NamingContext)
                |   |   +- realmMapping[link -> java:/jaas/customRealm] (class: javax.naming.LinkRef)
                |   |   +- subject[link -> java:/jaas/customRealm/subject] (class: javax.naming.LinkRef)
                |   |   +- securityMgr[link -> java:/jaas/customRealm] (class: javax.naming.LinkRef)
                |   |   +- security-domain[link -> java:/jaas/customRealm] (class: javax.naming.LinkRef)

               

              EJB Modules

              No finding any reference of those EJBs under this

               

               

              Global JNDIname

              I am not finding any reference of the EJBs under this

               

              I think it is not deployed correctly..not sure what I am missing out...

               

              Thanks,

              Gurmat

              • 4. Re: JNDI lookup issue - EJB not bound
                newguy2010

                I have similar issue but I am using JBoss 6 CR1 with EJB 2.1

                Caused by: javax.naming.NameNotFoundException: EBMyBean not bound

                at org.jnp.server.NamingServer.getBinding(NamingServer.java:771) [:5.0.5.Final]
                    at org.jnp.server.NamingServer.getBinding(NamingServer.java:779) [:5.0.5.Final]
                    at org.jnp.server.NamingServer.getObject(NamingServer.java:785) [:5.0.5.Final]
                    at org.jnp.server.NamingServer.lookup(NamingServer.java:443) [:5.0.5.Final]
                    at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:728) [:5.0.5.Final]
                    at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:688) [:5.0.5.Final]
                    at javax.naming.InitialContext.lookup(InitialContext.java:392) [:1.6.0_22]
                    at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:154) [:3.0.5.RELEASE]
                    at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:87) [:3.0.5.RELEASE]
                    at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:152) [:3.0.5.RELEASE]
                    at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:178) [:3.0.5.RELEASE]
                    at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:95) [:3.0.5.RELEASE]
                    at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:105) [:3.0.5.RELEASE]
                    at org.springframework.jndi.JndiObjectFactoryBean.lookupWithFallback(JndiObjectFactoryBean.java:201) [:3.0.5.RELEASE]
                    at org.springframework.jndi.JndiObjectFactoryBean.afterPropertiesSet(JndiObjectFactoryBean.java:187) [:3.0.5.RELEASE]
                    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477) [:3.0.5.RELEASE]


                    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417) [:3.0.5.RELEASE]
                    ... 114 more

                I tried to look it up through JMX console but I couldn't find the jndi name of the bean. However in the deployment log it said

                09:19:03,062 INFO  [EjbDeployer] installing bean: ejb/myapp.jar#EBMyBean,uid1165664
                09:19:03,062 INFO  [EjbDeployer]   with dependencies:
                09:19:03,062 INFO  [EjbDeployer]   and supplies:
                09:19:03,062 INFO  [EjbDeployer]     jndi:EBMyBean
                09:19:03,062 INFO  [EjbDeployer]     jndi:local/EBMyBean@11368117

                 

                so I am confused.

                • 5. Re: JNDI lookup issue - EJB not bound
                  newguy2010

                  Just to post the progress of solving the JNDI lookup issues I am facing.

                   

                  Previously I only used a ejb-jar.xml to specify ejb names but I didn't use a jboss.xml to specify jndi names. In JBoss 3.2.5, which is the previous JBoss version I have been using, a default JNDI name was given to the ejb object if no jndi name is specified. For some reason JBoss is able to look it up without a jboss.xml file and wouldn't put something like local/EBMyBean@11368117 as the jndi name.

                   

                  When I use JBoss 6 this doesn't work. I have to put a jboss.xml to specify jndi names. So I just put ejb/EBMyBean as the jndi name and JBoss is able to look it up as ejb/EBMyBean. I can also change the name to whatever I like but I guess the default jndi name always contain some number in it so it is hard to know what the default jndi name is.

                   

                  After changing the jndi names in a jboss.xml file I no longer see this EJB not bound error.

                   

                  My jboss.xml is something like this:

                   

                  <jboss>

                       <entity>
                          <ejb-name>EBMyBean</ejb-name>
                          <local-jndi-name>ejb/EBMyBean</local-jndi-name>
                      </entity>

                  </jboss>