2 Replies Latest reply on Mar 22, 2002 11:36 PM by Jeff DeLong

    Problems with JNDI lookup of OracleDS

    Jeff DeLong Master

      I have a custom service that runs in JBoss that access OracleDS. It works fine in JBoss-2.4.4. In JBoss-3.0.0beta I experience the following: if I dynamically load my service by copying in my customized version of a user-service.xml file (registered under the user JMX domain, name=user:service=MyServiceName)my service can access OracleDS (which is configured using the example in CVS). However, when I stop and restart JBoss, when my service is started it throws an exception: Cannot acquire datasource [OracleDS].

      OracleDS can be seen under JNDI view in the java namespace, and my code accesses the datasource with

      Context ic = new initialContext();
      Context ctx = (Context) ic.lookup("java:");
      DataSource ds = (DataSource) ctx.lookup(dataSourceName);

      where dataSourceName is OracleDS.

      So why can my service see the java namespace when it is dynamically deployed, but not on initial startup of JBoss?

      Thank for any thougths.

        • 1. Re: Problems with JNDI lookup of OracleDS
          David Jencks Master

          Perhaps your service is getting deployed before the OracleDS is getting deployed. You can add an anonymous mbean dependency to your service to make it wait for the OracleDS ConnectionFactoryLoader mbean, like this:

          <mbean code=.....>
          jboss.jca:service=OracleDS
          ..other attributes...


          Check the object name of the ConnectionFactoryLoader to make sure it matches.

          • 2. Re: Problems with JNDI lookup of OracleDS
            Jeff DeLong Master

            Thanks. In 2.4.4 the order of the services in the jboss.jcml controlled the order they were started up, I overlooked this when I migrated to 3.0.

            As you pointed out, getting the object name correct was important, in this case:

            jboss.jca:service=ConnectionFactoryLoader,name=OracleDS

            misspecifying this parameter causes the services to not start at all. Thanks again.