2 Replies Latest reply on Apr 9, 2008 1:36 PM by bml

    Oracle DS/JNDI Issue

    bml

      Hi,

      I am currently trying to access an Oracle datasource via JNDI that I have configured. I am using JBoss 4.0.3 on Windows XP Pro with Oracle 10g.

      The datasource seems to be binding correctly as I get the following message when I start the server:

      [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=OracleDS' to JNDI name 'java:OracleDS'
      


      The problem is that when I try to lookup the datasource in my application I can't get a reference to it. There are no errors thrown, but the datasource is null. Here is the code:

      DataSource dataSource = (DataSource)new InitialContext().lookup("java:OracleDS");
      


      Here is the oracle-ds.xml file that I am using:

      <?xml version="1.0" encoding="UTF-8"?>
      <datasources>
       <local-tx-datasource>
       <jndi-name>OracleDS</jndi-name>
       <connection-url>jdbc:oracle:thin:@//db.mydomain.com:1521/dbsid</connection-url>
       <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
       <user-name>user</user-name>
       <password>pwd</password>
       <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
       </local-tx-datasource>
      </datasources>
      



      Any help would be much appreciated. Thanks,

      barry

        • 1. Re: Oracle DS/JNDI Issue
          jaykraly

          Did you ever find a solution to this problem?

          I solved a very similar problem on my jboss 4.2.2 installation by changing around class loader configurations.

          • 2. Re: Oracle DS/JNDI Issue
            bml

            Eventually, I got it working by adding the following to my oracle-ds.xml file:

            <use-java-context>false</use-java-context>
            


            and changing the lookup code to:

            DataSource dataSource = (DataSource)new InitialContext().lookup("OracleDS");
            


            thanks,

            barry