无法登记同步。 LocalTransactionCoordinator 正在完成或已完成 hibernate spring 事务的问题

发布于 2024-08-28 12:09:55 字数 1550 浏览 1 评论 0原文

我收到 Cannot enlist Synchronization 消息。当从 portlet 调用集成我的方法时,LocalTransactionCoordinator 正在完成或已完成异常。

我正在使用 Spring 事务管理通过 AOP 处理 Spring 配置文件中的所有 Hibernate 事务。

当我运行 hibernate dao 方法通过 Junit 保存数据时,它工作正常。

异常描述:

我面临一个问题,即当我通过单元测试用例运行代码时,数据在数据库中正确更新,但是当我通过与 portlet 集成运行相同的代码时,我的代码执行得很好,但是交易完成后,记录不会更新到数据库。在日志中可以看到以下错误

[4/7/10 23:06:38:685 MDT] 0000006c LocalTranCoor E   WLTC0014E: Cannot enlist Synchronization. LocalTransactionContainment is completing or completed.
[4/7/10 23:06:38:689 MDT] 0000006c LocalTransact E   J2CA0026E: Method addSync caught java.lang.IllegalStateException: Cannot enlist Synchronization. LocalTransactionCoordinator is completing or completed.
      at com.ibm.ws.LocalTransaction.LocalTranCoordImpl.enlistSynchronization(LocalTranCoordImpl.java(Compiled Code))
      at com.ibm.ejs.j2c.LocalTransactionWrapper.addSync(LocalTransactionWrapper.java(Compiled Code))
      at com.ibm.ejs.j2c.ConnectionManager.initializeForUOW(ConnectionManager.java(Compiled Code))
      at com.ibm.ejs.j2c.ConnectionManager.involveMCInTran(ConnectionManager.java(Compiled Code))
      at com.ibm.ejs.j2c.ConnectionManager.associateConnection(ConnectionManager.java(Compiled Code))
      at com.ibm.ejs.j2c.ConnectionManager.associateConnection(ConnectionManager.java(Compiled Code))
      at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.reactivate(WSJdbcConnection.java(Compiled Code))
      at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.getWarnings(WSJdbcConnection.java:1539)

I am getting Cannot enlist Synchronization. LocalTransactionCoordinator is completing or completed exception when integrating my method is called from the portlet.

I am using spring transaction management for handling all the hibernate transaction in the spring configuration file through AOP.

When I run my hibernate dao method for persisting the data through Junit its working fine.

Exception description:

I am facing an issue that is when I run my code through unit test case data is getting updated in database properly but when I run the same code with integration with portlet my code is executing finely but after the completion of transaction the records is not getting updated to database. The following error can be seen in the log which is

[4/7/10 23:06:38:685 MDT] 0000006c LocalTranCoor E   WLTC0014E: Cannot enlist Synchronization. LocalTransactionContainment is completing or completed.
[4/7/10 23:06:38:689 MDT] 0000006c LocalTransact E   J2CA0026E: Method addSync caught java.lang.IllegalStateException: Cannot enlist Synchronization. LocalTransactionCoordinator is completing or completed.
      at com.ibm.ws.LocalTransaction.LocalTranCoordImpl.enlistSynchronization(LocalTranCoordImpl.java(Compiled Code))
      at com.ibm.ejs.j2c.LocalTransactionWrapper.addSync(LocalTransactionWrapper.java(Compiled Code))
      at com.ibm.ejs.j2c.ConnectionManager.initializeForUOW(ConnectionManager.java(Compiled Code))
      at com.ibm.ejs.j2c.ConnectionManager.involveMCInTran(ConnectionManager.java(Compiled Code))
      at com.ibm.ejs.j2c.ConnectionManager.associateConnection(ConnectionManager.java(Compiled Code))
      at com.ibm.ejs.j2c.ConnectionManager.associateConnection(ConnectionManager.java(Compiled Code))
      at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.reactivate(WSJdbcConnection.java(Compiled Code))
      at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.getWarnings(WSJdbcConnection.java:1539)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文