JTA 跨 数据库 异常
一个MySql ,一个 Oracle92, EJB 布署上去正常,自动创建表结构,当同时向两个数据库插入数据时服务器异常如下:
02:02:07,531 WARN [loggerI18N] [com.arjuna.ats.internal.jta.transaction.arjunacore.lastResource.disallow] [com.arjuna.ats.internal.jta.transaction.arjunacore.lastResource.disallow] Adding multiple last resources is disallowed. Current resource is org.jboss.resource.connectionmanager.TxConnectionManager$LocalXAResource@13cf3c5
02:02:07,531 WARN [
JDBCExceptionReporter] SQL Error: 0, SQLState: null
02:02:07,531 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: -3f57fd9e:c7b:49776f15:4b 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: -3f57fd9e:c7b:49776f15:4b status: ActionStatus.ABORT_ONLY >))
------解决方案--------------------“同时向两个数据库”
这个具体讲下,
connection都不一样,如何“同时”,不解,
------解决方案--------------------mysql从5.0开始支持XA DataSource。Connector/J 版本要使用5.0版本,5.0以下的不支持。
------解决方案--------------------我这边的问题解决了! 可以参考下
http://topic.csdn.net/u/20090209/21/d5c5170d-7892-46af-b8e3-24b2745d8c3d.html
good luck!