4 Replies Latest reply on Jul 2, 2003 3:59 PM by juhalindfors

    Lookup question

    bangclash

      In JBoss I created a datasource with a JNDI Name to be "jdbc/Accounts". To do the lookup the code looks like this:

      context.lookup("java:/jdbc/Accounts");

      I create the same datasource in WebSphere but the code looks like this:

      context.lookup("jdbc/Accounts");

      Why do I need to added "java:/" in JBoss for it to work?

        • 1. Re: Lookup question
          frito

          You can lookup a DS only in the server VM. Thus the java: namespace is the correct jndi namespace.

          I don't know what kind of object you are looking up with WebSphere. Perhaps it makes sense to allow a global look up, but I don't think so.

          Greetings,
          Frito

          • 2. Re: Lookup question
            atli

            bcoz of this i could not sleep all night yesterday.........
            i did not know we needed to include the jndi name prefixed to java:
            anyway all's well that ends well

            • 3. Re: Lookup question
              bangclash

              Do you know why we have to include the "java:" prefix? I don't have to do that with websphere.

              • 4. Re: Lookup question

                You don't (and probably should not) lookup directly from the java: name space, rather use the bean's private ENC (java:comp/env) and map that to the actual lookup name in your jboss.xml file.