4 Replies Latest reply on Jan 30, 2002 1:51 PM by dcelery

    Servlet don't meet a session EJB (in different  jars)

    dcelery

      I have a Session EJB, whose jndi-name is productos/Productos in jboss.xml.
      This ejb's are in productos.jar

      I have a servlet, and in jboss-web.xml i have an ejb-ref (productos/Productos) that point to the session ejb jndi-name productos/Productos.
      This servlet is in productos.war.

      Note: First i deployed productos.jar.
      After, y deployed productos.war .

      The servlet don't meet de session ejb!!
      why?

      (if i package .jar and .war in an .ear, that's OK, but not separately!!!)

        • 1. Re: Servlet don't meet a session EJB (in different  jars)

          Have a look at this link.
          The section you want is external EJB reference.

          http://www.jboss.org/online-manual/HTML/ch07s22.html

          Regards,
          Adrian

          • 2. Re: Servlet don't meet a session EJB (in different  jars)
            dcelery

            Ok, thanks Adrian.

            I'm here:
            jboss-web.xml:
            <!-- A reference to an EJB in the same server with a custom JNDI binding -->
            <ejb-ref>
            <ejb-ref-name>ejb/BHome</ejb-ref-name>
            <jndi-name>someapp/ejbs/beanB</jndi-name>
            </ejb-ref>

            I don't understand the <jndi-name> element.

            -Where is "someapp/ejbs"? is there in application.xml?

            Thanks, Diego

            • 3. Re: Servlet don't meet a session EJB (in different  jars)

              Have you specified a jndi-name in jboss.xml for the
              bean you want contact?

              Here's an example from the jboss testsuite

              [pre]
              META-INF/jboss.xml for the beans

              <enterprise-beans>

              <ejb-name>SecuredEJB</ejb-name>
              <jndi-name>jbosstest/ejbs/SecuredEJB</jndi-name>
              <configuration-name>Secure Stateless SessionBean</configuration-name>


              <ejb-name>UnsecuredEJB</ejb-name>
              <jndi-name>jbosstest/ejbs/UnsecuredEJB</jndi-name>
              <ejb-ref>
              <ejb-ref-name>ejb/Session</ejb-ref-name>
              <jndi-name>jbosstest/ejbs/SecuredEJB</jndi-name>
              </ejb-ref>

              </enterprise-beans>
              --snip--
              WEB-INF/jboss-web.xml for the war

              <jboss-web>
              --snip---
              <ejb-ref>
              <ejb-ref-name>ejb/UnsecuredEJB</ejb-ref-name>
              <jndi-name>jbosstest/ejbs/UnsecuredEJB</jndi-name>
              </ejb-ref>
              <ejb-ref>
              <ejb-ref-name>ejb/SecuredEJB</ejb-ref-name>
              <jndi-name>jbosstest/ejbs/SecuredEJB</jndi-name>
              </ejb-ref>
              </jboss-web>
              [/pre]

              Regards,
              Adrian

              • 4. Re: Servlet don't meet a session EJB (in different  jars)
                dcelery

                Yes, i have something like this:

                META-INF/jboss.xml for the beans

                <enterprise-beans>

                <ejb-name>BeanB</ejb-name>
                <jndi-name>productos/Productos</jndi-name>
                <configuration-name> </configuration-name>

                </enterprise-beans>
                --snip--
                WEB-INF/jboss-web.xml for the war

                <jboss-web>
                --snip---
                <ejb-ref>
                <ejb-ref-name>productos/Productos</ejb-ref-name>
                <jndi-name>productos/Productos</jndi-name>
                </ejb-ref>
                </jboss-web>


                Servlet code:

                Class servlet1….{

                ….lookup(“productos/Productos”)

                }

                thanks Diego