@Asynchronous Function 上偶尔会发生 EJBTransactionRolledbackException
我正在使用 Java 1.6.0_23 和 Glassfish 3.1.1。我有两个 Singleton EJB。一种是使用 TimerService 来触发 @Timeout 函数。在 @Timeout 期间,在另一个 Singleton EJB 中调用 @Asynchronous 函数。 95% 的时间都可以正常工作,不会出现任何错误。但另外 5% 的情况下,当调用 @Asynchronous 函数时,我会收到以下错误,但没有证据表明它甚至启动了 @Asynchronous 函数。没有记录其他错误详细信息。
有什么想法吗?
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
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.
Any ideas?
PS: I tried increasing the max number of EJBs in Glassfish from 32 to 64. No change.
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您必须查找在此错误之前发生的其他错误(可能是吞没的异常,因为您说没有其他错误)。如果当前 trx 已标记为回滚,并且您仍在数据库上执行操作,则会发生 EJBTransactionRolledbackException。
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.
我也发生过。
看来问题不是编码问题,而是服务器资源问题。
我增加了http线程池的大小
对我来说最大是 5,我将其更改为 10
似乎解决了问题。
这里还有一些关于此错误的注释:
http://pcjuzeren.blogspot.co.il/2008/12 /clients-transaction-aborted.html
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
Seems to resolved the problem.
Also some notes on this error here:
http://pcjuzeren.blogspot.co.il/2008/12/clients-transaction-aborted.html