Configuring JBoss AS7 for XA transations
dspiess Oct 5, 2012 2:44 PMHi,
We're looking to configure JBoss AS7 to connect to mulitple databases. This is what we have in our standalone.xml:
<xa-datasource jta="true" jndi-name="java:/cdsPersistence" pool-name="cdsPersistence_pool" enabled="true" use-java-context="true" use-ccm="true"> <xa-datasource-property name="URL"> jdbc:oracle:thin:@our_db:1521:schema </xa-datasource-property> <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class> <driver>oracle</driver> <xa-pool> <min-pool-size>10</min-pool-size> <max-pool-size>20</max-pool-size> <prefill>true</prefill> <use-strict-min>false</use-strict-min> <flush-strategy>FailingConnectionOnly</flush-strategy> </xa-pool> <security> <user-name>******</user-name> <password>******</password> </security> <validation> <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker"/> <validate-on-match>false</validate-on-match> <background-validation>false</background-validation> <stale-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker"/> <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter"/> </validation> <timeout> <set-tx-query-timeout>true</set-tx-query-timeout> <blocking-timeout-millis>30000</blocking-timeout-millis> <idle-timeout-minutes>30</idle-timeout-minutes> <query-timeout>120</query-timeout> <use-try-lock>60</use-try-lock> </timeout> <statement> <prepared-statement-cache-size>32</prepared-statement-cache-size> </statement> </xa-datasource>
We get these wanings non-stop in the logs:
16:24:26,078 WARN [com.arjuna.ats.jta] (Periodic Recovery) ARJUNA016027: Local XARecoveryModule.xaRecovery got XA exception XAException.XAER_RMERR: javax.transaction.xa.XAException at oracle.jdbc.xa.OracleXAResource.recover(OracleXAResource.java:709) at org.jboss.jca.adapters.jdbc.xa.XAManagedConnection.recover(XAManagedConnection.java:358) at org.jboss.jca.core.tx.jbossts.XAResourceWrapperImpl.recover(XAResourceWrapperImpl.java:162) at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.xaRecovery(XARecoveryModule.java:503) [jbossjts-4.16.2.Final.jar:] at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.resourceInitiatedRecoveryForRecoveryHelpers(XARecoveryModule.java:471) [jbossjts-4.16.2.Final.jar:] at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.bottomUpRecovery(XARecoveryModule.java:385) [jbossjts-4.16.2.Final.jar:] at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.periodicWorkSecondPass(XARecoveryModule.java:166) [jbossjts-4.16.2.Final.jar:] at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.doWorkInternal(PeriodicRecovery.java:789) [jbossjts-4.16.2.Final.jar:] at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.run(PeriodicRecovery.java:371) [jbossjts-4.16.2.Final.jar:]
From searching around it looks like we need to change the permissions in the database to correctly set up XA.
These permissions give viewable access to the distributed transaction views, as well as the DBMS_SYSTEM package.
GRANT SELECT ON sys.dba_pending_transactions TO our_db;
GRANT SELECT ON sys.pending_trans$ TO our_db;
GRANT SELECT ON sys.dba_2pc_pending TO our_db;
GRANT EXECUTE ON sys.dbms_system TO our_db;
My questions/concerns are this..
If JBoss is managing the distributed transactions, why does it need access to the views that are normally used by Oracle operations that call distributed transactions?
Why the need to access the DBMS_SYSTEM package?
What operations does XA try to execute using DBMS_SYSTEM?
Is there another way/better way to configure distributed transactions?
Thanks!