0 Replies Latest reply on Mar 24, 2005 1:46 PM by Yi-Ping Yao

    JNDI question: NameNotFoundException

    Yi-Ping Yao Newbie

      Hi, there,

      I have a simple test application, with one stateless session bean. But every time I'm trying to look it up, I got NameNotFoundException. The session bean JNDI is also not showing up in the Global JNDI namespace. I have another application almost exactly same as this one, only names and packages are different, but it works.

      Here is more detailed info on the non-working application:

      The session beans:

      ChangeProgramNameBean.java

      The XDoclet generated remote interfaces:

      ChangeProgramName.java
      ChangeProgramNameHome.java

      In ejb-jar.xml:


      <![CDATA[ChangeProgramNameSession returns bean]]>
      <display-name>ChangeProgramName EJB</display-name>

      <ejb-name>ChangeProgramName</ejb-name>

      [home]com.xxx.yyyy.ejb.interfaces.ChangeProgramNameHome[/home]
      [remote]com.xxx.yyyy.ejb.interfaces.ChangeProgramName[/remote]
      <ejb-class>com.xxx.yyyy.ejb.sessions.ChangeProgramNameBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>



      In jboss.xml:


      <ejb-name>ChangeProgramName</ejb-name>
      <jndi-name>com/xxx/yyyy/ejb/sessions/ChangeProgramName</jndi-name>


      In jboss-web.xml:

      <ejb-ref>
      <ejb-ref-name>ejb/ChangeProgramName</ejb-ref-name>
      <jndi-name>com/xxx/yyyy/ejb/sessions/ChangeProgramName</jndi-name>
      </ejb-ref>

      In web.xml:

      <ejb-ref>
      <![CDATA[Reference to the Change Program Name Session EJB]]>
      <ejb-ref-name>ejb/ChangeProgramName</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      [home]com.xxx.yyyy.ejb.interfaces.ChangeProgramNameHome[/home]
      [remote]com.xxx.yyyy.ejb.interfaces.ChangeProgramName[/remote]
      </ejb-ref>

      (Note: the squar brackets is in replace of < and >, since they cannot be displayed right here.)

      And in my code on the web site, I lookup the session bean:

      Context context = new InitialContext();
      Object ref = context.lookup("java:/comp/env/ejb/ChangeProgramName");
      home = (ChangeProgramNameHome) PortableRemoteObject.narrow(ref, ChangeProgramNameHome.class);

      But the Name not found exception was thrown at context.lookup line.

      Any ideas?

      Thanks a lot in advance.