2 Replies Latest reply on Mar 12, 2007 12:34 PM by Tony Mai

    Problem looking up EJB session bean (Name not bound)

    Tony Mai Apprentice

      Hello all,

      Can someone help me with a simple context lookup?

      I have a session bean deployed within JBoss 4.0.4 GA AS, JDK 5.

      My EJB3 code is as:

      public class AuthenticatorBean implements Authenticator {

      The server started and deployed this session bean without any problem. Here is a snippet of the log:

      10:28:10,609 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:ear=test.ear,jar=test.jar,name=AuthenticatorBean,service=EJB3 with dependencies:
      10:28:10,609 INFO [JmxKernelAbstraction] persistence.units:ear=test.ear,jar=test.jar,unitName=test
      10:28:10,625 INFO [EJBContainer] STARTED EJB: com.judots.test.AuthenticatorBean ejbName: AuthenticatorBean

      From an external client, my client is calling:
      Properties p = new Properties();
      p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      p.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
      p.put(Context.PROVIDER_URL, "jnp://localhost:1099");
      _intialCtx = new InitialContext(p);
      Object authenRef = _intialCtx.lookup("AuthenticatorBean");

      This code failed with the following exception:
      javax.naming.NameNotFoundException: AuthenticatorBean not bound
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)

      I tried using various name like "Authenticator", "Authenticator/remote", "AuthenticatorBean/remote" but ended up with the same "'name' not found error. Can some one please help?


        • 1. Re: Problem looking up EJB session bean (Name not bound)
          Joan Horta  Tosas Novice

          Try using AuthenticatorLocal.class.getName() for local interface and AuthenticatorRemote.class.getName() for remote interface.

          • 2. Re: Problem looking up EJB session bean (Name not bound)
            Tony Mai Apprentice

            I think the problem I am having is relating to the way I packaged my ear file.

            When I unpacked the ear and deployed only the jar file, I had no problem looking up the remote interfaces.

            I would greatly appreciate if someone can help clarifying what I need in my ear file. O'Reilly's Enterprise JavaBeans 3.0 does not seem to address this at all.

            Here is the structure of my ear file:


            My application.xml contains the following:
            <?xml version="1.0" encoding="UTF-8"?>
             <description>Test Project</description>
             <!-- The EJB-JAR -->
             <!-- TODO: JBoss needs 'ejb' element but the spec requires 'persistence' -->

            And my test-ds.xml is as followed:
            <?xml version="1.0" encoding="UTF-8"?>

            I think my test-ds.xml is OK because it worked with plain jar deployment. What else missing in my application.xml file?

            Thanks for your help.