2 Replies Latest reply on Apr 17, 2005 6:57 AM by darranl

    JBOSS 4 JNDI problem !!!

    mtigua

      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: JBOSS 4 JNDI problem !!!

          I would look in the source where the name is applied to the context. I would expect that you could set it there. But, the default is java:/ and it's just a name that's all.

          • 2. Re: JBOSS 4 JNDI problem !!!
            darranl

            I don't have a working example to hand to show you but what you are asking for is for a reference to the datasource to be bound to the component namespace of your web application.

            You need to add a resource-ref element to the web.xml of your web application and configure the reference as appropriate.