2 Replies Latest reply on May 10, 2002 8:46 AM by smeng

    EJBHome lookup failed, NamingException null error

    smeng

      Hi.

      I have successfully deployed my stateless session bean on JBoss and my application is trying to do a lookup.My JNDI is bound successfully but I the lookup returns a null value.

      Hashtable env = new Hashtable();
      env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      env.put(Context.PROVIDER_URL, "localhost:1099");
      env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
      ctx = new InitialContext(env);
      EJBHome ejbHome = null;
      Object home = (EJBHome)ctx.lookup(lookup);
      ejbHome = (EJBHome) PortableRemoteObject.narrow(home, EJBHome.class);

      I've done some print line statements to check where it's going wrong and basically it's at the Object line where it does the lookup when it fails. The JNDI name is correct because lookup not bound did not appear in my logs. Instead I've got a Naming Exception is null value.

      Can someone help me?

      Thanks in advance.

        • 1. Re: EJBHome lookup failed, NamingException null error
          sebaseba

          The (EJBHome) cast in the "Object home = ..." line seems a bit unusual and unnecessary.

          /Sebastian

          • 2. Re: EJBHome lookup failed, NamingException null error
            smeng

            I finally figured out was wrong. It wasn't a Naming Exception but it was merealy a root exception of ClassNotFoundException. It couldn't find my class. I have some util classes that has a startup with JBoss. Do I deploy my EJB with the utility jar file that I put into lib/ext directory and also the EAR containing the EJB with the deployment descriptors again in the deploy directory? Well, so far this seems to work for me but I'm wondering if there's anyway to avoid the duplication. I'm not too sure about manual deployment so...

            Thanks.

            Smeng