3 Replies Latest reply on Oct 22, 2006 12:23 AM by jaikiran pai

    InitialContext results in Directory listing

    Marc Jakobsson Newbie

      Hi,

      Im a newbie to EJB. Im trying to access a statless session bean. Im using eclipse with the j2ee plugin with xdoclet. The problem is I get is that I get a Directory listing when running this code:

      <%

      String s = "empty";
      try {
      TestLocalHome testLocalHome = (TestLocalHome)new InitialContext().lookup("java:TestLocal");

      TestLocal testBean = testLocalHome. create();
      s = testBean.sum(10,10);
      }
      catch (Exception e)
      {
      s=e.toString();
      }
      %>
      The result is <%=s %>



      The ejb-jar.xml:


      <![CDATA[An EJB named Test]]>
      <display-name>Test</display-name>

      <ejb-name>Test</ejb-name>
      se.tesella.ejb.TestHome
      se.tesella.ejb.Test
      <local-home>se.tesella.ejb.TestLocalHome</local-home>
      se.tesella.ejb.TestLocal
      <ejb-class>se.tesella.ejb.TestSession</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>


      the jboss.xml:


      <ejb-name>Test</ejb-name>
      <jndi-name>Test</jndi-name>
      <local-jndi-name>TestLocal</local-jndi-name>
      <method-attributes>
      </method-attributes>


      The jboss-web.xml:

      <jboss-web>
      <context-root>ReAdvertWebModule</context-root>
      <ejb-ref>
      <ejb-ref-name>Test</ejb-ref-name>
      <jndi-name>Test</jndi-name>
      </ejb-ref>
      </jboss-web>

      The web.xml:

      <ejb-ref>
      <ejb-ref-name>Test</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      se.tesella.ejb.TestHome
      se.tesella.ejb.Test
      <ejb-link>TestBean</ejb-link>
      </ejb-ref>

      Also, anothe question, are all these xml files neccessary?

      Kind regards