多数のクエリの実行に問題があります。
1 つのトランザクション内で 10,000 を超えるネイティブ SQL クエリを実行する必要があります。これらのクエリは動的に生成され、システムにキャッシュされます。クエリの生成が完了すると、それらが送信され、1 つのトランザクション内で 1 つずつ実行されます。アプリケーションは EJB 3 を使用して開発され、JBoss 5.1 で実行されます。
クエリの数が 7200 (概算値) 未満の場合、アプリケーションは正常に動作します。ただし、これよりも多くのクエリがある場合、メソッドは EJB 例外をスローし、トランザクションはロールバックされます。データは保持されません。
これは、ロールバックが発生する場所です。【クエリ数が7200以上の場合のみ】
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public void confirmOrder(String[] queries) {
for (int i = 0; i < queries.length; i++) {
em.createNativeQuery(queries[i]).executeUpdate(); //line # 108
}
BigInteger bigInt = (BigInteger)em.createNativeQuery("select max(id) from order_item").getSingleResult();
return bigInt!=null ? Long.valueOf(bigInt.longValue()) : null;
}
トランザクション内で実行できるクエリの数を増やす方法はありますか? これについてあなたの提案をしてください。
/ビラジ
The following is the error trace.
17:36:33,233 WARN [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.TransactionReaper_18] - TransactionReaper::check timeout for TX -3f57767b:bc55:4fd9d129:e3a3 in state RUN
17:36:33,238 WARN [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.TransactionReaper_7] - TransactionReaper::doCancellations worker Thread[Thread-10,5,jboss] successfully canceled TX -3f57767b:bc55:4fd9d129:e3a3
17:36:33,635 WARN [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.TransactionReaper_18] - TransactionReaper::check timeout for TX -3f57767b:bc55:4fd9d129:e3bf in state RUN
17:36:33,636 WARN [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.BasicAction_58] - Abort of action id -3f57767b:bc55:4fd9d129:e3bf invoked while multiple threads active within it.
17:36:33,636 WARN [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.CheckedAction_2] - CheckedAction::check - atomic action -3f57767b:bc55:4fd9d129:e3bf aborting with 1 threads active!
17:36:34,135 WARN [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.TransactionReaper_18] - TransactionReaper::check timeout for TX -3f57767b:bc55:4fd9d129:e3bf in state CANCEL
17:36:34,635 WARN [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.TransactionReaper_18] - TransactionReaper::check timeout for TX -3f57767b:bc55:4fd9d129:e3bf in state CANCEL_INTERRUPTED
17:36:34,636 WARN [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.TransactionReaper_6] - TransactionReaper::check worker Thread[Thread-10,5,jboss] not responding to interrupt when cancelling TX -3f57767b:bc55:4fd9d129:e3bf -- worker marked as zombie and TX scheduled for mark-as-rollback
17:36:34,636 WARN [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.TransactionReaper_11] - TransactionReaper::check failed to mark TX -3f57767b:bc55:4fd9d129:e3bf as rollback only
17:36:34,904 WARN [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator_4] TwoPhaseCoordinator.afterCompletion - returned failure for com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple@5a720719
17:36:34,926 WARN [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.TransactionReaper_13] - TransactionReaper::doCancellations worker Thread[Thread-10,5,jboss] missed interrupt when cancelling TX -3f57767b:bc55:4fd9d129:e3bf -- exiting as zombie (zombie count decremented to 0) ........
......
17:36:34,935 ERROR [CardOrderCreateFacadeBean] Confirming order is failed.
javax.ejb.EJBTransactionRolledbackException: Executing an update/delete query
at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:115)
at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:130)
at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:194)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.security.RunAsSecurityInterceptorv2.invoke(RunAsSecurityInterceptorv2.java:94)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.security.RoleBasedAuthorizationInterceptorv2.invoke(RoleBasedAuthorizationInterceptorv2.java:201)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:186)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
........................
...............
Caused by: javax.persistence.TransactionRequiredException: Executing an update/delete query
at org.hibernate.ejb.QueryImpl.executeUpdate(QueryImpl.java:48)
at rk.ejb.eao.OrderEAOImpl.confirmOrder(OrderEAOImpl.java:108)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.aop.joinpoint.MethodInvocation.invokeTarget(MethodInvocation.java:122)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:111)
at org.jboss.ejb3.EJBContainerInvocationWrapper.invokeNext(EJBContainerInvocationWrapper.java:69)
at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.invoke(InterceptorSequencer.java:76)
at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.aroundInvoke(InterceptorSequencer.java:62)
at sun.reflect.GeneratedMethodAccessor358.invoke(Unknown Source)
........
.......