1 Reply Latest reply on May 15, 2003 2:50 AM by Jon Barnett

    using JNDI to obtain datasources from remote clients

    sys user Master


      I have a datasource bound to the JNDI name "java:/XOracleDS". Unfortunately, I can't access this datasource from a remote client. The following code results in a javax.naming.NameNotFoundException: XAOracleDS not bound.

      java.util.Properties jndiProperties = new java.util.Properties();

      jndiProperties.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory" );

      jndiProperties.setProperty( Context.URL_PKG_PREFIXES, "org.jboss.naming:org:jnp.interfaces" );

      jndiProperties.setProperty(Context.PROVIDER_URL, "jnp://myhost:1099" );

      Context context = new InitialContext( jndiProperties );

      javax.sql.DataSource ds = ( javax.sql.DataSource ) context.lookup( "java:/XAOracleDS" );

      However, I can access the datasource without errors from any server-side component. That is, the following code works fine (from the server):

      Context context = new InitialContext();
      javax.sql.DataSource ds = ( javax.sql.DataSource ) context.lookup( "java:/XAOracleDS" );

      Also, a call to context.listBindings( "java:" ) from the server generates a substantial list of all bindings; however, when the same code is executed from the client, the client generates an empty list (i.e., nothing appears to be bound).

      Does anyone have any suggestions? I would appreciate them.


      - Jon