java EJBTransactionRolledbackException 偶尔发生在@Asynchronous 函数上

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7347177/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-30 19:36:11  来源:igfitidea点击:

EJBTransactionRolledbackException occasionally occurs on @Asynchronous Function

javajakarta-eeglassfishejb

提问by mauman

I am using Java 1.6.0_23 and Glassfish 3.1.1. I have two Singleton EJBs. One is using the TimerService to fire the @Timeout function. During the @Timeout, an @Asynchronous function in called in the other Singleton EJB. It works 95% of the time without any errors. But the other 5% of the time when the @Asynchronous function is called, I get the following error with no evidence that it even started the @Asynchronous function. No other error details are logged.

我使用的是 Java 1.6.0_23 和 Glassfish 3.1.1。我有两个单例 EJB。一种是使用 TimerService 来触发 @Timeout 函数。在@Timeout 期间,另一个Singleton EJB 中调用了一个@Asynchronous 函数。它可以在 95% 的时间内正常工作,没有任何错误。但是在调用@Asynchronous 函数的另外 5% 的时间里,我收到以下错误,但没有证据表明它甚至启动了 @Asynchronous 函数。不会记录其他错误详细信息。

Any ideas?

有任何想法吗?

PS: I tried increasing the max number of EJBs in Glassfish from 32 to 64. No change.

PS:我尝试将 Glassfish 中 EJB 的最大数量从 32 增加到 64。没有变化。

java.util.concurrent.ExecutionException: javax.ejb.EJBTransactionRolledbackException
        at com.sun.ejb.containers.EjbAsyncTask.call(EjbAsyncTask.java:132) ~[ejb-container.jar:3.1.1]
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) ~[na:1.6.0_23]
        at java.util.concurrent.FutureTask.run(FutureTask.java:138) ~[na:1.6.0_23]
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) ~[na:1.6.0_23]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) ~[na:1.6.0_23]
        at java.lang.Thread.run(Thread.java:662) ~[na:1.6.0_23]
Caused by: javax.ejb.EJBTransactionRolledbackException: null
        at com.sun.ejb.containers.BaseContainer.mapLocal3xException(BaseContainer.java:2305) ~[ejb-container.jar:3.1.1]
        at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:2088) ~[ejb-container.jar:3.1.1]
        at com.sun.ejb.containers.EjbAsyncTask.call(EjbAsyncTask.java:114) ~[ejb-container.jar:3.1.1]
        ... 5 common frames omitted
Caused by: javax.ejb.TransactionRolledbackLocalException: Client's transaction aborted
        at com.sun.ejb.containers.BaseContainer.useClientTx(BaseContainer.java:4699) ~[ejb-container.jar:3.1.1]
        at com.sun.ejb.containers.BaseContainer.preInvokeTx(BaseContainer.java:4577) ~[ejb-container.jar:3.1.1]
        at com.sun.ejb.containers.BaseContainer.preInvoke(BaseContainer.java:1910) ~[ejb-container.jar:3.1.1]
        at com.sun.ejb.containers.EjbAsyncTask.call(EjbAsyncTask.java:99) ~[ejb-container.jar:3.1.1]
        ... 5 common frames omitted

回答by alvi

You'll have to look for other errors that happened before this one (maybe swallowed exceptions, since you said there are no other errors). EJBTransactionRolledbackException occurs if the current trx has been marked for a rollback, and you're still doing stuff on the DB.

您必须查找在此之前发生的其他错误(可能是吞下异常,因为您说没有其他错误)。如果当前 trx 已标记为回滚,并且您仍在 DB 上执行操作,则会发生 EJBTransactionRolledbackException。

回答by Ronen Morecki

Happened to me as well. Seems the problem is not a coding problem, but server resources.

也发生在我身上。似乎问题不是编码问题,而是服务器资源问题。

I increased the http thread pool size It was 5 max for me and I changed it to 10

我增加了 http 线程池大小对我来说最大为 5,我将其更改为 10

Seems to resolved the problem.

似乎解决了问题。

Also some notes on this error here: http://pcjuzeren.blogspot.co.il/2008/12/clients-transaction-aborted.html

还有一些关于这个错误的说明:http: //pcjuzeren.blogspot.co.il/2008/12/clients-transaction-aborted.html