覆盖MDB bean的defaultTransactionTimeOut,该MDB bean的事务由CMT控制并部署在TOMEE中

时间:2018-12-10 13:47:58

标签: ejb tomee

在处理完消息并将控件返回到MDB之后,我遇到了以下错误

    javax.transaction.SystemException: Error during two phase commit
at org.apache.geronimo.transaction.manager.TransactionImpl.commitResources(TransactionImpl.java:702)at org.apache.geronimo.transaction.manager.TransactionImpl.commit(TransactionImpl.java:327)at org.apache.geronimo.transaction.manager.TransactionManagerImpl.commit(TransactionManagerImpl.java:252)

我尝试在TOMEE(tomee.xml)中设置事务超时

<TransactionManager id="MyTransactionManager" type="TransactionManager">
    defaultTransactionTimeout = 65 minutes
</TransactionManager>

还在MDB中添加transationManger作为资源

@Resource
private TransactionManager tx;

@PostConstruct
public void iniitialize() {
    try {
        tx.setTransactionTimeout(2400);
    } catch (javax.transaction.SystemException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

这两种方法都不起作用,并且行为也不一致。

0 个答案:

没有答案