1 Reply Latest reply on Sep 3, 2010 3:29 PM by phil.meyer

    Oracle XA datasource configuration

    phil.meyer

      Hi guys.  I work in a shop that has been using JBoss 4.2.3 in production, and has recently started upgrading to JBoss 6 (the newest m4 version).

       

      I've encountered a number of problems during the upgrade, but this is the first I've been stuck on.  Basically, I can't get a connection from the OracleXADatasource.

       

      The root cause of the exception is this (can post more of stacktrace if needed):

       

      Caused by: java.sql.SQLException: Invalid argument(s) in call
              at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70) [:Oracle JDBC Driver version - "11.1.0.7.0-Production"]
              at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:133) [:Oracle JDBC Driver version - "11.1.0.7.0-Production"]
              at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:199) [:Oracle JDBC Driver version - "11.1.0.7.0-Production"]
              at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:263) [:Oracle JDBC Driver version - "11.1.0.7.0-Production"]
              at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:271) [:Oracle JDBC Driver version - "11.1.0.7.0-Production"]
              at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:445) [:Oracle JDBC Driver version - "11.1.0.7.0-Production"]
              at oracle.jdbc.xa.client.OracleXADataSource.getXAConnection(OracleXADataSource.java:97) [:Oracle JDBC Driver version - "11.1.0.7.0-Production"]
              at org.jboss.resource.adapter.jdbc.xa.XAManagedConnectionFactory.getXAManagedConnection(XAManagedConnectionFactory.java:449) [:6.0.0.20100721-M4]

       

      This error message is with the oracle6.jar driver, but I've also tried it with the oracle5.jar and oracle14.jar drivers.  Same error message with just the driver version different in the logging.  I have unpleasant words for the developer that gave such a useless error message.  I have no idea what argument(s) it thinks are bad.

       

      The oracle-xa-ds.xml file that is in use for the 4.2.3 jboss server was this (sensitive information and comments removed):

       

      <?xml version="1.0" encoding="UTF-8"?>
      <datasources>
          <xa-datasource>
              <jndi-name>OracleDS</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:@10.1.9.200:1521:serviceName
              </xa-datasource-property>
              <xa-datasource-property name="User">
                  my_username
              </xa-datasource-property>
              <xa-datasource-property name="Password">
                  my_password
              </xa-datasource-property>
              <min-pool-size>1</min-pool-size>
              <max-pool-size>50</max-pool-size>
              <prepared-statement-cache-size>
                  256
              </prepared-statement-cache-size>
              <exception-sorter-class-name>
                  org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter
              </exception-sorter-class-name>
              <no-tx-separate-pools />
             <metadata>
                  <type-mapping>Oracle9i</type-mapping>
              </metadata>
          </xa-datasource>
          <xa-datasource>
              <jndi-name>VRSOracleDS</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:@10.1.9.200:1521:serviceName
              </xa-datasource-property>
              <xa-datasource-property name="User">
                  my_username
              </xa-datasource-property>
              <xa-datasource-property name="Password">
                  my_password
              </xa-datasource-property>
              <min-pool-size>1</min-pool-size>
              <max-pool-size>200</max-pool-size>
              <prepared-statement-cache-size>
                  256
              </prepared-statement-cache-size>
              <exception-sorter-class-name>
                  org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter
              </exception-sorter-class-name>
              <no-tx-separate-pools />

       

              <metadata>
                  <type-mapping>Oracle9i</type-mapping>
              </metadata>
          </xa-datasource>

       

          <mbean
              code="org.jboss.resource.adapter.jdbc.vendor.OracleXAExceptionFormatter"
              name="jboss.jca:service=OracleXAExceptionFormatter">
              <depends optional-attribute-name="TransactionManagerService">
                  jboss:service=TransactionManager
              </depends>
          </mbean>

       

      </datasources>

       

      I don't know how I am supposed to change this file for the newer version of JBoss, and can't find the documentation for it if I am.

       

      I've tried switching to a local transaction datasource, and that works fine.  There is some code in our application that seems to require XA transactions, so this change just bought me some time.  Now I have to go back and figure this out.

       

      I've tried messing with the settings in the datasource configuration XML, but it all seems to get me the same error.  Even pulling almost every element out of the XML but this:

       

      <?xml version="1.0" encoding="UTF-8"?>
      <datasources>
          <xa-datasource>
              <jndi-name>OracleDS</jndi-name>
              <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
              <xa-datasource-property name="URL">jdbc:oracle:thin:@10.1.9.200:1521:serviceName</xa-datasource-property>
          </xa-datasource>
      </datasources>

       

      Gives the same "invalid argument(s) in call" error message.

       

      Does anyone know what my problem might be, or has an example oracle-xa-ds.xml that works?  I've done a few hours of googling and reading through documentation today, but so far have not found a solution.

       

      Thanks.

        • 1. Re: Oracle XA datasource configuration
          phil.meyer

          Guess I just needed to bang on it some more.  Did a "bottom up" approach and got an XA datasource working.  Realized then that the problem was the line breaks in my XML elements.  The two versions of jboss must parse the XML differently, since after I formatted the XML to not have the line breaks between the elements and the values, it works.