3 Replies Latest reply on Aug 26, 2002 4:57 AM by cdkcdk

    jndi lookup

    tonik

      what is the difference between doing a jndi lookup for /ejb/Interest and java:/ejb/Interest and which one should be used.

        • 1. Re: jndi lookup

          In the usual setup you tend to either lookup 'Interest', which is a lookup to the global namespace of the JNDI, meaning it's accessible to clients outside the server JVM. The object 'Interest' is bound in case of EJBs based either on the <ejb-name> element in your ejb-jar.xml file, or based on the <jndi-name> element in your jboss.xml file if you want to override the default <ejb-name>.

          Bean implementation are recommended to use a lookup from their private namespace (only visible to the bean itself) which is under 'java:comp/env' namespace. By convention, many people put their EJB references under the 'ejb' namespace, therefore doing a lookup to 'java:comp/env/ejb/SomeName'. The 'ejb/SomeName' is then mapped to the actual EJB it references in the ejb-jar.xml file using the <ejb-ref> element.

          It's a difference of doing a direct global name lookup or an indirect private name lookup. Using the latter allows the deployer/assembler to manage the global naming service with names that make sense to their domain, without having to edit/recompile the bean implementations which are insulated via their own private name space. The bean implementation therefore do not contain 'hard coded' assumption of their deployment and naming environment.

          • 2. Re: jndi lookup
            pvamstel

            Does anyone know a good reference or tutorial about the jndi names. I'm still puzzeled about what is defaulted where to put stuff. Default naming conventions etc etc

            • 3. Re: jndi lookup
              cdkcdk