2 Replies Latest reply on Apr 14, 2005 4:54 PM by jimm

    JCA JNDI problem !

    Mario Tigua Newbie

      Hi everbody ! I'm trying to configure a oracle datasource for JBOSS 4. My oracle-xa-ds.xml (specific jboss file) looks like:

      <jndi-name>JdelfosDataSource</jndi-name> <track-connection-by-tx/> <isSameRM-override-value>false</isSameRM-override-value> <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class> <xa-datasource-property name="URL">jdbc:oracle:thin:@192.168.124.40:1521:idelfos</xa-datasource-property> <xa-datasource-property name="User">mario</xa-datasource-property> <xa-datasource-property name="Password">mario</xa-datasource-property>

      and my servlet looks like :

      javax.sql.DataSource ds =(javax.sql.DataSource) ctx.lookup("java:JdelfosDataSource");

      This functions very well.

      How I can configure oracle-xa-ds.xml (or another file) so that my servlet reference JNDI name like this : javax.sql.DataSource ds =(javax.sql.DataSource) ctx.lookup("java:comp/env/jdbc/JdelfosDataSource"); ?

      Thanks. Mario.

        • 1. Re: JCA JNDI problem !
          jimm Newbie

          Put this in your web.xml (as per spec will put it in comp/env):
          <resource-ref>
          My important datasource
          <res-ref-name>jdbc/JdelfosDataSource</res-ref-name>
          <res-type>javax.sql.DataSource</res-type>
          <res-auth>Container</res-auth>
          </resource-ref>

          And this in your jboss-web.xml (which maps from global to local):
          <resource-ref>
          <res-ref-name>jdbc/JdelfosDataSource</res-ref-name>
          <res-type>javax.sql.DataSource</res-type>
          <jndi-name>java:/JdelfosDataSource</jndi-name>
          </resource-ref>


          see [jboss install]/docs/dtd/jboss-web_4_0.dtd for xml syntax specifics

          • 2. Re: JCA JNDI problem !
            jimm Newbie

            One more time, with proper formatting

            Put this in your web.xml (as per spec will put it in comp/env):

            <resource-ref>
             <description>My important datasource</description>
             <res-ref-name>jdbc/JdelfosDataSource</res-ref-name>
             <res-type>javax.sql.DataSource</res-type>
             <res-auth>Container</res-auth>
             </resource-ref>


            And this in your jboss-web.xml (which maps from global to local):
            <resource-ref>
             <res-ref-name>jdbc/JdelfosDataSource</res-ref-name>
             <res-type>javax.sql.DataSource</res-type>
             <jndi-name>java:/JdelfosDataSource</jndi-name>
             </resource-ref>


            see [jboss install]/docs/dtd/jboss-web_4_0.dtd for xml syntax specifics