1 Reply Latest reply on Jan 29, 2003 1:31 PM by Rodrigo Machado Benevides

    jdbc not bound - NameNotFoundException?

    Carl Ahrens Newbie

      Hi!

      I am a new user of JBoss (3.0.4) and have some problems with a Postgresql datasource.

      The datasource is created and bound to java:/jdbc/PostgresDS and is visible in the JNDIViewer in jmx-console.

      In my war-file i have created the jboss-web.xml file in the WEB-INF directory containing the following text:

      <jboss-web>
      <resource-ref>
      <res-ref-name>jdbc/PostgresDS</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <jndi-name>java:/jdbc/PostgresDS</jndi-name>
      </resource-ref>
      </jboss-web>

      and the web.xml file contains the following section:

      <resource-ref>
      Datasource for Postgresql
      <res-ref-name>jdbc/PostgresDS</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>CONTAINER</res-auth>
      </resource-ref>

      Now to my problem.

      When I try to call my datasource using:

      Context compEnv = (Context) initCtx.lookup("java:comp/env/jdbc/PostgresDS");

      I got a "jdbc not bound - NameNotFoundException"

      But when I am using the jndi name "java:/jdbc/PostgresDS" instead it works fine.

      Why does it not work with the local jndi name, have I missed something in my configuration?

      Thanks!