gpt4 book ai didi

java - Spring MVC = 事务不再活跃

转载 作者:行者123 更新时间:2023-11-30 07:56:02 25 4
gpt4 key购买 nike

我有一个基于 Spring Web 模型- View - Controller (MVC) 框架的项目。 Spring Web模型- View - Controller (MVC)框架的版本是3.2.8,部署在WebLogic Server版本:12.1.2.0.0

我在 1 个查询中有这个错误

Caused By: java.lang.RuntimeException: java.sql.SQLException: 
The transaction is no longer active - status: 'Marked rollback. [Reason=weblogic.transaction.internal.TimedOutException: Transaction timed out after 31 seconds
BEA1-000D9470C1367F28EDB9]'.
No further JDBC access is allowed within this transaction., criteria [ com.tdk.books.domain.ProductSearchCriteria@c5f15d5c ], sql [ select PRODUCT_ID from V_BOOKS where category_id = ? ]

即使我在服务方法中设置了 10000 的超时

@Transactional(timeout=10000, propagation = Propagation.REQUIRES_NEW)

最佳答案

来自 Oracle 社区的根本原因:

Usuallly this happens when a transaction is finished, but this fact is ignored and an app tries to continue processing and to issue JDBC statements that happen outside of the TX. The source of this problem could be a Connection object that is passed around through a sequence of methods that use the connection. One of such methods commits the TX thus invalidating the connection.

资源链接:https://community.oracle.com/thread/734370

找到了一些解决问题的建议。

第一个建议:

Please try changing your weblogic datasource settings from Non - XA to XA. You should get rid of this exception.

资源链接:The transaction is no longer active - status: 'Committed'

第二个建议:

Uncheck the Supports Global Transactions restart the server.

资源链接:In PRPC ERROR: The transaction is no longer active - status: 'Committed'

第三条建议:

The real solution of this problem is asynchronous processing. But it might be possible that it's not suitable in your case.

First one If you are making any jdbc call to Oracle, then you can set the query time out whn you execute the query on database. And after query timeout, Oracle will give you an exception that you can handle it. So basically in this case you are not cancelling your EJB request actually. But it might solve your problem.

资源链接:https://coderanch.com/t/68079/transaction-rollback-commit

关于java - Spring MVC = 事务不再活跃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42649435/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com