3 Replies Latest reply on Jan 16, 2004 6:27 AM by darranl

    Datasource not bound problem

    huskerchen

      Hi:

      I am running Postgresql on a remote server. JBOSS sits on the local server. I am trying to test the data source. I deployed the "Postgresal-ds.xml" to the deployment folder, and the JBOSS log says:

      [PostgresDS] Bound connection factory for resource adapter for ConnectionManager 'jboss.jca:service=LocalTxCM,name=PostgresDS to JNDI name 'java:/PostgresDS'

      Then I use the following code to look up the datasource:

      props.put(InitialContext.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      
      props.put(InitialContext.PROVIDER_URL, "jnp://localhost:1099");
       Context ctx = new InitialContext(props);
      DataSource ds = (DataSource)ctx.lookup("java:/PostgresDS");


      An exception comes out:

      javax.naming.NameNotFoundException: PostgresDS not bound

      What's missing here? It seems the JBOSS log said the data source was bound to "java:/PostgresDS", why this JNDI name is not bound when I tried to connect to the data source?

      Thanks a lot!