8 Replies Latest reply on Jul 4, 2008 11:05 AM by jaikiran pai

    EJB not bound :

    Meghana Chemburkar Newbie

      We migrated our application from Jboss 3.2.5 to 4.0.2.
      All EJBs in application are local, Added <ejb-local-ref> in web.xml
      and all JNDI names are java:comp/env/xyzEJB

      For all other EJBs, application is working fine except following one and gives error :
      "NameNotFoundException: CustomerEJB not bound" error.

      I checked the http://localhost:8080/jmx-console/

       "Global JNDI Namespace"
       +- local (class: org.jnp.interfaces.NamingContext)
       | +- CustomerEJB@29336323 (proxy: $Proxy103 implements interface com.xyz.customer.LocalCustomerHome)

      So this indicates that ejb-ref for CustomerEJB is fine.
      Then why am I getting NameNotFoundException

      Thanks in advance.

        • 2. Re: EJB not bound :
          Meghana Chemburkar Newbie

          I already have the chages mentioned in the link you sent.
          Still no luck...
          It just this one entity bean which is having problem, for the rest of the Entity & Session beans project is working fine.

          Thanks is advance.

          • 3. Re: EJB not bound :
            jaikiran pai Master

            Post your ejb-jar.xml and jboss.xml and if possible, the code, where this bean is being accessed.

            • 4. Re: EJB not bound :
              Meghana Chemburkar Newbie

              I am getting this error when I started migrating my project from JBoss 3.2.5 to 4.0.2
              All the EJBs in the application are local.

              In JBoss 3.2.5

              JNDI name
              public static final String CUST_LOCAL_HOME = "local/CustomerEJB";
               <description>CUSTOMER table</description>
               No JBoss.xml
               EJB Access code:
               LocalCustomerHome custHome = (LocalCustomerHome)servicelocator.getLocalHome(JNDINames.CUST_LOCAL_HOME);
               LocalCustomer custObj = custHome.create(myCustVO);

              For project we have xyzEJB.jar with all EJB and related classes
              xyz.war has all classes in xyzEJB.jar + web stuff such as JSP,.html, tld,etc.

              I made following changes for JBoss 4.0.2

              JNDI name
              public static final String CUST_LOCAL_HOME = "java:comp/env/CustomerEJB";
              ejb-jar.xml same as above
              No JBoss.xml
              Added following in web.xml for each EJB
              EJB Access code:
              same as above.

              For JBoss 4.0.2, I excluded all the EJBs (3 files for each EJB) from xyz.war file.
              So xyz.war will not have any EJBs now.
              Somebody told me that we can get these kinds of errors if:
              1) we have duplicate classes in xyz.war & xyzEJB.jar file (I checked that I don't have any)
              2) some classes which should be xhyEJB.jar are in xyz.jar instead.
              e.g.in CustomerEJB create() has myCustVO , so CustVo.class should be in xyzEJB.jar not in zyz.jar.

              I haven't tried the option 2 yet.

              Thanks in advance.

              • 5. Re: EJB not bound :
                Meghana Chemburkar Newbie

                The issue was resolved.Didn't realized that it was case of EJB calling EJB.
                The code was:
                SomeEJB.someMethod() --> DAO.getCustomer() --> CustomerEJB

                So I put <ejb-local-ref> element in ejb-jar.xml for "SomeEJB" and error was gone.

                Thanks for all replies.

                • 6. Re: EJB not bound :
                  Anirban Gupta Newbie

                  Hi, I'm trying to call a stateless session bean from another stateless sessino bean, using remote lookup, but while while looking up the called ejb jndi tree from the calling ejb, i'm getting an exception .......ejb not bound. please help

                  • 7. Re: EJB not bound :
                    Arvind MV Newbie

                    Hi All,

                    I know that many have posted the same query but i followed some steps based on this post. But still i am unable to resolve the issue.

                    My test program is as shown below:

                    nitialContext iniCtx= null;
                    Context ejbCtx = null;
                    CryptoHome home=null;
                    Properties props = null;
                    //MyBeanLocal local = null;
                    Object ref = null;
                    CryptoHome cryptoHome=null;
                    try {

                    /* iniCtx = new InitialContext();
                    //ejbCtx = (Context) iniCtx.lookup("java:comp/env/ejb/Crypto");
                    //home = (CryptoHome) iniCtx.lookup("Crypto"); //java:comp/env/
                    home = (CryptoHome) new InitialContext().lookup("java:comp/env/ejb/Crypto"); */
                    props = new Properties();
                    props.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interface");
                    props.put(Context.PROVIDER_URL, "jnp://localhost:1099");
                    // I have tried "localhost:1099",, etc as well

                    Context ctx= new InitialContext(props);
                    // *never makes it here, exception NameNotFoundException*

                    //Object ref = ctx.lookup("MyBeanLocal");
                    cryptoHome = (CryptoHome)ctx.lookup("java:comp/env/Crypto");
                    //local = cryptoHome.create();
                    } catch (NamingException e1) {
                    // TODO Auto-generated catch block

                    At the crypto home it is throwing the nullpointer exception, is it right way of mentioning the JNDI name. In the Jboss console it shows javax.naming.NameNotFoundException: Crypto not bound

                    Please let me know the solution.


                    • 8. Re: EJB not bound :
                      jaikiran pai Master


                      In the Jboss console it shows javax.naming.NameNotFoundException: Crypto not bound

                      Follow the steps mentioned at http://wiki.jboss.org/wiki/DisplayTheJNDITreeWithTheJMXConsole and find the jndi-name of your bean. Then use that jndi-name for looking up the bean.