4 Replies Latest reply on Jun 20, 2002 11:37 PM by codecowboy

    JNDI lookup failures - JBoss 2.4.6

    codecowboy

      Hello:

      I am having trouble accessing the DefaultDS datasource in JBoss using JNDI. I have verified that DefaultDS is bound by looking at JNDI View once the server is up, and when the server boots, it is bound to java:/DefaultDS.

      When I attempt to do a lookup, I repeatedly get a lookup exception "Name not bound".

      I have verified the following:
      1. the provider URL is set to jnp://hostname:1099, (Context.PROVIDER_URL) NOTE: hostname is not my servername, just an example.
      2. the JNDI prefix mappings are set in the initial context properly. (via Context.URL_PKG_PREFIXES
      3. The appropriate client jars are present and in my classpath.
      4. The client code is correct (I code against Weblogic all the time, so I am well acquainted with JNDI).
      5. The context factory is set properly via Context.INITIAL_CONTEXT_FACTORY
      6. I am using the default socket factory.
      7. I am using the JBoss Quick Start Guide as my reference (pages 27 and 28).

      The thing that is throwing me off is the JBoss use of JNDI namespaces. Since DefaultDS is bound to the "java:" namespace, shouldn't the provider URL be java://hostname:1099? Instead of jnp://hostname:1099

      Any help would be appreciated, as the Documentation I bought covers JBoss up to version 2.4.5, and the Quick Start guide I found is for version 3.0. I also consulted the SAMS book, but got no further on this issue.

      Thanks

        • 1. Re: JNDI lookup failures - JBoss 2.4.6

          The java:/ namespace can only be accessed inside
          the same virtual machine.

          Regards,
          Adrian

          • 2. Re: JNDI lookup failures - JBoss 2.4.6
            codecowboy

            kind of defeats the purpose of JNDI, doesn't it? (remote lookups of common services)

            • 3. Re: JNDI lookup failures - JBoss 2.4.6

              It depends.

              Do you want to bind your datasource into the global
              namespace, retrieve a connection from a pool and then
              send it over the network?
              Isn't it better to have a local pool?

              Also, depending upon your config, your datasource could
              give insecure access to the database.

              These considerations are the purpose of the java:/
              namespace.

              Regards,
              Adrian

              • 4. Re: JNDI lookup failures - JBoss 2.4.6
                codecowboy

                I see your point, and in a production environment, the ideal would be to have datasources only accessible from
                the JBoss VM.

                I got started on this because I want to test JDBC connectivity. I just installed a MySQL driver, so I wrote a client program to get a connection from the pool using a DataSource, to see if the driver works. The java: namespace is preventing me from doing this test.

                Can I temporarily bind my data source into the global
                namespace? I could find no documentation on this in the
                PDF manual I bought online.

                Thanks