资源DATASOURCE在清除LocalTransactionContainment时回滚 [英] Resource DATASOURCE rolled back in cleanup of LocalTransactionContainment

查看:2680
本文介绍了资源DATASOURCE在清除LocalTransactionContainment时回滚的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Im在WebSphere Application Server 7,JDK 1.6和Oracle 11g中工作。

Im working in a WebSphere Application Server 7, JDK 1.6 and Oracle 11g.

当使用ejb时,总是会收到此错误。

Im always receiving this error when using an ejb.


[7/1/10 17:12:28:770 BOT] 00000013
LocalTranCoor W WLTC0033W:资源
jdbc / oraDS11回滚清除
LocalTransactionContainment。
[7/1/10
17:12:28:773 BOT] 00000013
LocalTranCoor W WLTC0032W:一个或
更多的本地事务资源是
清除一个
LocalTransactionContainment。

[7/1/10 17:12:28:770 BOT] 00000013 LocalTranCoor W WLTC0033W: Resource jdbc/oraDS11 rolled back in cleanup of LocalTransactionContainment. [7/1/10 17:12:28:773 BOT] 00000013 LocalTranCoor W WLTC0032W: One or more local transaction resources were rolled back during the cleanup of a LocalTransactionContainment.

这是从WAS中的数据源获取连接。

This is how im getting the connection from the datasource in WAS.

javax.sql.DataSource ds = (javax.sql.DataSource) naming.lookup("DataSource");
conn= ds.getConnection();

任何帮助都会感激...

Any help will be appreciated...

推荐答案

从错误消息中,您正在本地事务中执行一些工作,并不提交。未提交的工作在方法结束时由容器回滚(默认情况下)。

From the error message, you are doing some work inside a local transaction and not committing it. The uncommitted work gets rolledback by the container at the end of the method (by default).

WAS6.0中的数据源回滚总结了所有这些,并且因为没有真正的意义,

This answer to Datasource rollback in WAS6.0 summarizes all this pretty well and since there is no real point at paraphrasing it, I'm quoting it below.


A LocalTransactionContainment 是什么
在没有全局
(XA)事务的情况下。消息
表示您作为
包含范围(方法或活动
会话)的一部分执行了一些
本地事务工作,然后未提交
默认行为(由
unresolved-action控制)是回滚
作用域结束处的任何
uncommited工作。您有多个选项:

A LocalTransactionContainment is what you get in the absence of a global (XA) transaction. The message indicates that you performed some local transaction work as part of that containment scope (method or activity session) and then did not commit. The default behaviour (controlled by unresolved-action) is to rollback any uncommited work at the end of the scope. You have a number of options:


  • 显式提交本地事务

  • Explicitly commit the local transaction

connection.commit(); // after the work has been performed


  • 更改数据源以使用auto-commit

  • Change the data source to use auto-commit

    connection.setAutoCommit(true); //
    

    将工作放置在全局事务中

    Place the work within a global transaction

    Context ic = new InitialContext();
    UserTransaction ut =
    (UserTransaction) ic.lookup("java:comp/UserTransaction");
    ut.begin();
    // use connection here
    ut.commit();
    


  • 将未解决操作更改为提交

    选择 '选项卡
    部署描述符编辑器和
    然后选择有问题的servlet。
    在'WebSphere Extensions'下,然后
    'Local Transaction'从
    下拉菜单中将
    'Unresolved Action'设置为'Commit'。

  • Change the unresolved-action to commit
    Select the 'Servlets' tab on the deployment descriptor editor and then select the servlet in question. Under 'WebSphere Extensions' and then 'Local Transaction' set the 'Unresolved Action' to 'Commit' from the drop-down menu.

    我建议你明确地提交工作(并阅读整个答案)。

    I'd suggest committing the work explicitly (and reading the whole answer).

    这篇关于资源DATASOURCE在清除LocalTransactionContainment时回滚的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆