2 Replies Latest reply on Nov 12, 2002 8:42 AM by Fabrizio Boco

    Calling EJB from JSP

    Fabrizio Boco Newbie

      Hi guys,

      I have successfully deployed an Entity EJB called Progetto which defines the local interface only.

      Then I have the following code in an JSP page:

      .....

      try
      {
      env = new Hashtable();
      env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      context = new InitialContext(env);

      home = (ProgettoLocalHome)context.lookup("java:comp/env/ejb/ProgettoLocalHome");
      ........
      }
      catch(Exception e)
      {
      out.println(e.getMessage());
      }

      .....

      and the following web.xml

      <web-app>
      Empty web.xml file for Web Application
      <session-config>
      <session-timeout>30</session-timeout>
      </session-config>
      <mime-mapping>
      html
      <mime-type>text/html</mime-type>
      </mime-mapping>
      <mime-mapping>
      txt
      <mime-type>text/plain</mime-type>
      </mime-mapping>
      <welcome-file-list>
      <welcome-file>index.jsp</welcome-file>
      <welcome-file>index.html</welcome-file>
      </welcome-file-list>
      <ejb-local-ref>
      <ejb-ref-name>ejb/ProgettoLocal</ejb-ref-name>
      <ejb-ref-type>Entity</ejb-ref-type>
      <local-home>mypackage3.ProgettoLocalHome</local-home>
      mypackage3.ProgettoLocal
      <ejb-link>Progetto</ejb-link>
      </ejb-local-ref>
      </web-app>

      When I call the jsp page i get the following error:

      ProgettoLocalHome not bound

      What's wrong ?

      Please, help me !!!!

      Many Thanks.