5 Replies Latest reply on Sep 19, 2003 1:05 PM by Adrian Brock

    Strange JNDI NameNotFoundException

    rickyeng Newbie

      I am trying to deploy a couple of stateless session beans on JBoss 3.2.2. I lookup the first SLSB from a JSP page. The SLSB then performs a second JNDI lookup to retrieve the second SLSB. Both SLSBs have local interfaces. I have packaged the deployment into an ear file which deploys without errors or warnings.

      The strange part:
      I can successfully lookup the first SLSB from the JSP page. A listing of the JNDI bindings from the JSP page shows both SLSBs bound as expected. However, when the first SLSB attempts to lookup the second SLSB, I get a NameNotFoundException. A listing of the JNDI bindings from the first SLSB shows no EJBs bound. That is: I can perform JNDI lookups from the servlet container but not the EJB container.

      My application.xml:
      <?xml version="1.0" encoding="ISO-8859-1"?>
      <!DOCTYPE application PUBLIC '-//Sun Microsystems, Inc.
      //DTD J2EE Application 1.2//EN'
      'http://java.sun.com/j2ee/dtds/application_1_2.dtd'>


      <display-name>Stocks</display-name>

      Stocks.jar



      <web-uri>Stocks.war</web-uri>
      <context-root>/stocks</context-root>




      My ejb-jar.xml
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">

      <ejb-jar>
      No Description.
      <display-name>Generated by XDoclet</display-name>
      <enterprise-beans>

      <ejb-name>StockLookupEJB</ejb-name>
      <local-home>com.server.stock.StockLookupHome</local-home>
      com.server.stock.StockLookupLocal
      <ejb-class>com.server.stock.StockLookupEJB</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>


      <ejb-name>JNDILookupExampleEJB</ejb-name>
      <local-home>com.server.example.JNDILookupExampleHome</local-home>
      com.server.example.JNDILookupExampleLocal
      <ejb-class>com.server.example.JNDILookupExampleEJB</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>

      </enterprise-beans>

      </ejb-jar>

      My jboss.xml:
      <?xml version="1.0" encoding="UTF-8"?>


      <enterprise-beans>

      <ejb-name>StockLookupEJB</ejb-name>
      <jndi-name>StockLookupEJB</jndi-name>


      <ejb-name>JNDILookupExampleEJB</ejb-name>
      <jndi-name>JNDILookupExampleEJB</jndi-name>

      </enterprise-beans>


      My web.xml:
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE web-app PUBLIC
      "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
      "http://java.sun.com/dtd/web-app_2_3.dtd">

      <web-app>
      <display-name>Stocks</display-name>
      <!-- example of a reference to a EJB that is collated in the same deployment unit -->
      <ejb-local-ref>
      <ejb-ref-name>StockLookupEJB</ejb-ref-name> <!-- Must match <ejb-name> in ejb-jar.xml -->
      <ejb-ref-type>Session</ejb-ref-type>
      <local-home>com.server.stock.StockLookupHome</local-home>
      com.server.stock.StockLookupLocal
      <ejb-link>Stocks.jar#StockLookupEJB</ejb-link> <!-- Must match jarName#<ejb-name> in ejb-jar.xml -->
      </ejb-local-ref>

      <ejb-local-ref>
      <ejb-ref-name>JNDILookupExampleEJB</ejb-ref-name> <!-- Must match <ejb-name> in ejb-jar.xml -->
      <ejb-ref-type>Session</ejb-ref-type>
      <local-home>com.server.example.JNDILookupExampleHome</local-home>
      com.server.example.JNDILookupExampleLocal
      <ejb-link>Stocks.jar#JNDILookupExampleEJB</ejb-link> <!-- Must match jarName#<ejb-name> in ejb-jar.xml -->
      </ejb-local-ref>

      </web-app>


      tia,
      Ricky