2 Replies Latest reply on Jul 9, 2003 1:12 AM by chemapo

    Problem deploying

    chemapo

      Hi,

      I'm trying to deploy my first web application and I have the next problem:

      My directories (D) in the deploy directory are:

      deploy
      ----- cart_session.war (D)
      -------------index.jsp
      ------------ WEB-INF (D)
      ---------------- jboss-web.xml
      --------------- web.xml
      ----------- classes(D)
      --------------- cart_session(D)
      --------------------- Cart
      --------------------- CartBean
      --------------------- CartHome
      --------------------- Item

      My ejb is a stateful session bean and i'm trying to access it directly from a jsp (index.jsp)

      I have declared an ejb external reference as in
      http://wwwswt.fzi.de/~christo/praktikum/j2eeapi/jboss/doc/ch07s22.html

      my Jboss-web.xml file:

      <!DOCTYPE jboss-web
      PUBLIC "-//JBoss//DTD Web Application 2.3//EN"
      "http://www.jboss.org/j2ee/dtds/jboss-web_3_0.dtd">
      <jboss-web>
      <ejb-ref>
      <ejb-ref-name>cart_session/CartHome</ejb-ref-name>
      <jndi-name>ejb/cart_session/Cart</jndi-name>
      </ejb-ref>
      </jboss-web>


      my web.xml file:

      <!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>

      <servlet-name>index</servlet-name>
      <jsp-file>/index.jsp</jsp-file>


      <ejb-ref>
      <ejb-ref-name>cart_session/CartHome</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      cartSession.CartHome
      cart_session.Cart
      </ejb-ref>
      </web-app>

      My index.jsp file is:

      <%@ page
      session="false"
      isThreadSafe="true"
      isErrorPage="false"
      import="javax.naming.*,
      cart_session.*,
      java.util.*"
      %>

      <%
      try {
      Context lContext = new InitialContext();
      Object ref=lContext.lookup("java:comp/env/ejb/cart_session/Cart");

      }
      catch( Exception e ) {
      out.println( "Caugth exception: " + e.getMessage() );
      e.printStackTrace();
      }

      During deployment process, jboss informs that cart_session.war has been deployed succesfully but when i browse index.jsp it can locate my ejb jndi_name, i have also tried to find my ejb jndi name using jmx-console jndiview-->list and i couldn't find it.

      Could you help me please

        • 1. Re: Problem deploying

          <ejb-ref-name>cart_session/CartHome</ejb-ref-name>

          binds the ejb-ref at

          java:comp/env/cart_session/CartHome

          Regards,
          Adrian

          • 2. Re: Problem deploying
            chemapo

            Hi,

            I have replaced the next line in index.jsp

            Object ref=lContext.lookup("java:comp/env/ejb/cart_session/Cart");

            from

            Object ref=lContext.lookup("java:comp/env/cart_session/CartHome");

            and now, i have the next exception when jboss runs my .jsp:

            Caugth exception: Could not dereference object

            the jboss console shows something like this:

            07:01:54,220 ERROR [STDERR] javax.naming.NamingException: Could not dereference
            object. Root exception is
            07:01:54,220 ERROR [STDERR] javax.naming.NameNotFoundException: cart_session not
            bound
            07:01:54,220 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(Naming
            Server.java:495)
            07:01:54,220 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(Naming
            Server.java:503)


            Could you help me please


            Thanks in advance,