0 Replies Latest reply on Jun 17, 2004 3:15 PM by jonasj

    servlet and entity bean problem

    jonasj Newbie

      I have a project and spent 2 full days and not able to get it working.

      I am using jboss3.2.3.
      I have a servlet and entity bean (BMP). Servlet neeeds to talk to
      entity bean. this is the portion of code in servlet init:
      Context context = new InitialContext();
      Object ref = context.lookup("ArticleLocalHomeNickName");
      articleLocalHome = (ArticleLocalHome) PortableRemoteObject.narrow(ref, ArticleLocalHome.class);


      Servlet's war file's web.xml has:

      <ejb-local-ref>
      <ejb-ref-name>ejb/ArticleLocalHomeNickName</ejb-ref-name>
      <ejb-ref-type>Entity</ejb-ref-type>
      <local-home>net.xys.jm.articleEJB.ArticleLocalHome</local-home>
      net.xyz.jm.articleEJB.ArticleLocal

      </ejb-local-ref>

      and META-INF/jboss-web.xml has:
      <ejb-local-ref>
      <ejb-local-ref>
      <ejb-ref-name>ejb/ArticleLocalHomeNickName</ejb-ref-name>
      <local-jndi-name>ejb/ArticleLocalHomeNickName</local-jndi-name>
      </ejb-local-ref>

      Jboss throws this exection:
      Error during deploy; - nested throwable: (javax.naming.NamingException: ejb-ref: ejb/ArticleHomeNickName, no
      ejb-link in web.xml and no jndi-name in jboss-web.xml)

      Note that I also have defined in web.xml and jboss-web.xml "ArticleHomeNickName" reference in the same way.

      in the entity bean ejb-jar.xml
      <jndi-name>ArticleHomeNickName</jndi-name>
      <local-jndi-name>ArticleLocalHomeNickName</local-jndi-name>

      and in entity bean's jboss.xml
      <ejb-name>Article</ejb-name>
      <jndi-name>ArticleHomeNickName</jndi-name>
      <local-jndi-name>ArticleLocalHomeNickName</local-jndi-name>


      I also tried to use <ejb-link> but this did not work either.
      Please help. The 700 page jboss documentation that cost me $10 do
      not talk about deployment desricptors and how servlet and ejb
      should be set up.