2 Replies Latest reply on Aug 6, 2004 7:25 AM by Junior Carl

    JNDI lookup

    Junior Carl Newbie

      I have an entity bean that calls another entity bean. I noticed that the following lookup doesn't work:

      XXXHome xxxHome = (XXXLocalHome) ctx.lookup("java:comp/env/ejb/XXXLocalHome");

      but if I remove "java:comp/env", it works. Any idea why? What should I do if I want to use the full path?

        • 1. Re: JNDI lookup
          Alexey Loubyansky Master

          What you call a full path is called ENC path in the spec. You should configure ejb-ref or ejb-local-ref to get the EJB refences into the ENC. Otherwise, you are looking it up in the global JNDI context.

          • 2. Re: JNDI lookup
            Junior Carl Newbie

            Thanks for your answer.

            It just seems a bit strange. I've seen ejb-ref and ejb-local-ref being configured for session beans but never entity beans. All the examples I've seen on the web never had to configure ejb-ref and ejb-local-ref for entity beans and still able to do a lookup with the ENC path.

            It's no big deal really. Just something that's worth knowing.

            Anyone with experience on app servers other than JBoss would like to share their experience?