3 Replies Latest reply on Dec 14, 2002 10:43 PM by xieby2001

    A simple CMP EJB, can not found EJB by lookup method, what's

    xieby2001

      There 4 EJBs

      entity beans

      studentBean:
      ejb-name="student"
      jndi-name="ejb/school/student"
      local-jndi-name="ejb/school/studentLocal"

      contactBean:
      ejb-name="contact"
      jndi-name="ejb/school/contact"
      local-jndi-name="ejb/school/contactLocal"

      courseBean:
      ejb-name="course"
      jndi-name="ejb/school/course"
      local-jndi-name="ejb/school/courseLocal"

      specialtyBean:
      ejb-name="specialty"
      jndi-name="ejb/school/specialty"
      local-jndi-name="ejb/school/specialtyBeanLocal"

      session bean
      xstudioBean:
      Client through xstudioBean to access the entity bean.


      relationship between them:
      (student:contact)-(1:1)
      (student:course)-(m:n)
      (student:specialty)-(n:1)

      My code can be compiled and deploied. But when I wrote a client to access the entity bean, an exception occured, it seems like xstudioBean can not lookup then entity bean. This is my Jndi-name in xstudioBean:

      private final static String JNDI_NAME_STUDENT = "java:comp/env/ejb/school/student";
      private final static String JNDI_NAME_CONTACT = "java:comp/env/ejb/school/contact";
      private final static String JNDI_NAME_COURSE = "java:comp/env/ejb/school/course";
      private final static String JNDI_NAME_SPECIALTY = "java:comp/env/ejb/school/specialty";


      my lookup method in xstudioBean:

      private studentLocalHome lookupStudent()
      throws NamingException
      {
      Context initial = new InitialContext();
      Object objref = initial.lookup(JNDI_NAME_STUDENT);
      return (studentLocalHome)objref;
      }


      I use xdocelet to generate deployment descripte file.