Bo's blog

Saturday, November 14, 2009

ERROR IN RECOVERY com.atomikos.datasource.ResourceException: Error in recovery at com.atomikos.datasource.xa.XATransactionalResource.recover(XATransactionalResource.java:800)

 

Oracle Error in Recovery

When Oracle is not properly configured for XA then the following error may show up in the Atomikos console file:

Error in recovery

null [thread: main] on: 07-10-02 12:49:59,116

at: oracle.jdbc.xa.OracleXAResource.recover(OracleXAResource.java:526)

at: com.atomikos.datasource.xa.XATransactionalResource.recover(XATransactionalResource.java:574)

at: com.atomikos.datasource.xa.XATransactionalResource.endRecovery(XATransactionalResource.java:659)

at: com.atomikos.icatch.imp.TransactionServiceImp.recover(TransactionServiceImp.java:630)

at: com.atomikos.datasource.xa.XATransactionalResource.setRecoveryService(XATransactionalResource.java:506)

at: com.atomikos.icatch.system.Configuration.addResource(Configuration.java:331) 

Solution: make sure that Oracle is configured for XA - as in ConfiguringOracle, and that the userid for which XA is required has access rights on the XA catalog tables (explained in ConfiguringOracle as well).

 

Configuring Oracle for XA

Changed by GuyPardon on 18 Apr 2009 - 12:01 - r8

AtomikosDataSourceBean example

AtomikosDataSourceBean ds = new AtomikosDataSourceBean();
ds.setUniqueResourceName("oracle");
ds.setXaDataSourceClassName("oracle.jdbc.xa.client.OracleXADataSource");
Properties p = new Properties();
p.setProperty ( "user" , "java" );
p.setProperty ( "password" , "java" );
p.setProperty ( "URL" , "jdbc:oracle:thin:@localhost-xe:1521:XE" );
ds.setXaDataSourceProperties ( p );


Notes



Oracle 9.2 and Oracle 10 are both working fine. It is highly recommended to use the latest Oracle 10 JDBC driver even when connecting to Oracle 9 databases.



Oracle's DBMS must be configured with extra packages before you can use it with XA:



grant select on sys.dba_pending_transactions to <user name>;
grant select on sys.pending_trans$ to <user name>;
grant select on sys.dba_2pc_pending to <user name>;
grant execute on sys.dbms_system to <user name>;


Also see here: ConfiguringOracleForXA



 



Configuring Oracle for XA



Changed by GuyPardon on 22 Jul 2008 - 03:31 - r1







Oracle 10.2 and lower



NOTE: this tip was written with Oracle DBMS version 10.2.0.2.0



How can you know if your Oracle server is correctly configured for XA?



The simplest and usually the most effective way is the following:




  • logon to SQLPlus (or use another tool if you like); make sure to use the user/password that you are using for your application


  • execute the query: select * from SYS.DBA_PENDING_TRANSACTIONS;



If this works then XA is configured.



If not then you should do one or all of the following:




  1. run the oracle scripts 'initxa.sql' and 'xaview.sql' (or ask your DBA to do this for you).


  2. ask your DBA to grant select rights (to your user) on SYS.DBA_PENDING_TRANSACTIONS


  3. for the driver ojdbc14.jar, you also need execute rights on SYS.DBMS_SYSTEM



The last step is NOT needed for the older (JDK 1.2) drivers in classes12.jar



Oracle 11 and higher



For Oracle 11, you no longer need execute rights on SYS.DBMS_SYSTEM

Labels:

0 Comments:

Post a Comment

<< Home