10 Replies Latest reply on Oct 10, 2013 3:25 PM by raizcor

    Oracle XA datasource with oci driver

    raizcor

      Hello,

       

      I've a problem trying to use the oci driver with Oracle 10g XE for an xa datasource.

       

      My app runs in a Jboss 5.1 server and this is the datasource configuration:

       

       <xa-datasource>
       <jndi-name>ORACLE_DS</jndi-name>
       <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
       <xa-datasource-property name="URL">jdbc:oracle:oci8:@XE</xa-datasource-property>
       <security-domain>oracle-hibernate</security-domain>
       <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
       <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
       <track-connection-by-tx />
       <isSameRM-override-value>false</isSameRM-override-value>
       <no-tx-separate-pools />
       <min-pool-size>2</min-pool-size>
       <max-pool-size>25</max-pool-size>
       </xa-datasource>
      

       

      How you can see I'm using XE as the tns service name, my $TNS_ADMIN is pointing to my linux home dorectory where is the tnsnames.ora file:

       

      XE =
        (DESCRIPTION =
          (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
          (CONNECT_DATA =
            (SERVER = DEDICATED)
            (SERVICE_NAME = XE)
          ))
      

       

      For me all looks clean but it doesn't work. This is the error I'm getting from the server:

       

      20:57:54,017 WARN  [TxConnectionManager] Connection error occured: 
      org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener@155a2e
      [state=NORMAL mc=org.jboss.resource.adapter.jdbc.xa.XAManagedConnection@1ad96b4 
      handles=0 lastUse=1302055072412 permit=true trackByTx=true 
      mcp=org.jboss.resource.connectionmanager.JBossManagedConnectionPool$PoolBySubject@aead4b
       context=org.jboss.resource.connectionmanager.InternalManagedConnectionPool@1f352c5 
      xaResource=org.jboss.resource.adapter.jdbc.xa.XAManagedConnection@1ad96b4 txSync=null]
      oracle.jdbc.xa.OracleXAException
          at oracle.jdbc.xa.OracleXAResource.checkError(OracleXAResource.java:938)
          at oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:244)
      .
      .
      .
      20:57:54,024 ERROR [STDERR] java.lang.IllegalMonitorStateException
      20:57:54,024 ERROR [STDERR]     at java.util.concurrent.locks.ReentrantLock$Sync.tryRelease
        (ReentrantLock.java:127)
      .
      .
      .
      20:57:54,129 WARN  [JDBCExceptionReporter] SQL Error: 0, SQLState: null
      20:57:54,129 ERROR [JDBCExceptionReporter] Could not enlist in transaction on
       entering meta-aware object!; - nested throwable: (javax.transaction.SystemException:
       java.lang.Throwable: Unabled to enlist resource, see the previous warnings.
       tx=TransactionImple < ac, BasicAction: a040d3d:96b5:4d9bc88b:6b status:
       ActionStatus.ABORT_ONLY >); - nested throwable: (org.jboss.resource.JBossResourceException:
       Could not enlist in transaction on entering meta-aware object!; - nested throwable:
       (javax.transaction.SystemException: java.lang.Throwable: Unabled to enlist resource,
       see the previous warnings. tx=TransactionImple < ac, BasicAction: a040d3d:96b5:4d9bc88b:6b
       status: ActionStatus.ABORT_ONLY >))
      .
      .
      .
      20:57:54,146 ERROR [STDERR] Caused by: org.hibernate.exception.GenericJDBCException:
       Cannot open connection
      20:57:54,146 ERROR [STDERR]     at org.hibernate.exception.
       SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:126)
      .
      .
      .
      20:57:54,147 ERROR [STDERR] Caused by: org.jboss.util.NestedSQLException: Transaction is not active:
       tx=TransactionImple < ac, BasicAction: a040d3d:96b5:4d9bc88b:6b status: ActionStatus.ABORT_ONLY >; -
       nested throwable: (javax.resource.ResourceException: Transaction is not active: tx=TransactionImple
       <ac, BasicAction: a040d3d:96b5:4d9bc88b:6b status: ActionStatus.ABORT_ONLY >)
      20:57:54,147 ERROR [STDERR]     at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection
       (WrapperDataSource.java:95)
      20:57:54,147 ERROR [STDERR]     at org.hibernate.connection.DatasourceConnectionProvider
       .getConnection(DatasourceConnectionProvider.java:92)
      20:57:54,147 ERROR [STDERR]     at org.hibernate.jdbc.ConnectionManager.openConnection
       (ConnectionManager.java:446)
      20:57:54,147 ERROR [STDERR]     ... 151 more
      20:57:54,147 ERROR [STDERR] Caused by: javax.resource.ResourceException: Transaction is not active:
       tx=TransactionImple < ac, BasicAction: a040d3d:96b5:4d9bc88b:6b status: ActionStatus.ABORT_ONLY >
      20:57:54,148 ERROR [STDERR]     at org.jboss.resource.connectionmanager.TxConnectionManager
       .getManagedConnection(TxConnectionManager.java:370)
      20:57:54,148 ERROR [STDERR]     at org.jboss.resource.connectionmanager.BaseConnectionManager2
       .allocateConnection(BaseConnectionManager2.java:496)
      


      It looks like theres a connection problem but I can't find what it is, so any help will be appreciated.