Discussions

EJB programming & troubleshooting: problems configuring JNDI name lookup

  1. problems configuring JNDI name lookup (1 messages)

    Hi all,

    I am creating a novice web application using JBoss, Struts and Hibernate. I have problems creating a EJB Home object using JNDI lookup. The lookup method always throws an exception.

    Here are some of the details of my program:

    Action class (subclass of Action):
    InitialContext ctx = new InitialContext();
    mySchoolHome = (SchoolHome)ctx.lookup("java:comp/env/ejb/SchoolHome");

    web.xml:
    <jndi-link>
    <jndi-name>java:comp/env/ejb</jndi-name>
    <jndi-factory>org.jnp.interfaces.NamingContextFactory</jndi-factory>
    </jndi-link>

    jboss.xml:
    <jboss>
    <enterprise-beans>
    <session>
    <ejb-name>SchoolEJB</ejb-name>
    <jndi-name>ejb/SchoolHome</jndi-name>
    </session>
    </enterprise-beans>
    </jboss>

    I am a novice to J2EE applications. Please help me out.
  2. Hi dear
    i am sending you one thing coding part u should try this


    <enterprise-beans>
        <entity>
          <description>Entity Bean ( CMP )</description>
          <display-name>DodAuthorisation</display-name>
          <ejb-name>DodAuthorisation</ejb-name>
          <home>model.CMP.DodAuthorisationHome</home>
          <remote>model.CMP.DodAuthorisation</remote>
          <ejb-class>model.CMP.DodAuthorisationBean</ejb-class>
          <persistence-type>Container</persistence-type>
          <prim-key-class>java.lang.String</prim-key-class>
          <reentrant>False</reentrant>
          <cmp-version>2.x</cmp-version>
          <abstract-schema-name>DodAuthorisation</abstract-schema-name>
          <cmp-field>


    Context context = getInitialContext();
    DodAuthorisationHome dodAuthorisationHome = (DodAuthorisationHome)PortableRemoteObject.narrow(context.lookup("DodAuthorisation"), DodAuthorisationHome.class));


    this will help u out