Spring EJB 调用的事务:当 Try 的事务方法有 RuntimeException 时,Catch 中的事务方法需要 REQUIRES_NEW

Spring transaction called by EJB: REQUIRES_NEW needed for transactional method in Catch, when Try's transactional method has RuntimeException

我正在从非事务 class try 块(由另一个 EJB class 调用)调用事务方法 A,这将抛出 RuntimeException

然后在 catch 块中,事务方法 B 将处理 exp。

奇怪的是我必须用REQUIRES_NEW注解methodB,否则程序会出现Transaction is not active异常。 (堆栈跟踪类似于 this

这是不是因为methodA的事务在catch块中还没有结束,标记为RuntimeException回滚。然后没有REQUIRES_NEW的methodB重用了待回滚的事务,登陆异常?

这违背了我对 spring 事务的理解,因为我认为 methodA 的事务应该以 try 块中的 methodA 结束。方法 B 将创建一个新事务,因为不再存在任何事务。

//non-transactional method
method(){
    ...
    try{
         classA.methodA();
    }catch(RuntimeException ex){
         classB.methodB(ex);
    }
    ...
}

ClassA
    @Transactional
    methodA(){...}

ClassB
    @Transactional
    methodB(){...}


堆栈跟踪:

我正在使用 jBoss 和 DB2

handleEsbExceptionalRequirementmethodB

第一行是methodA

抛出的错误
16:32:35,603 ERROR [au.com.aia.euwb.services.newbusiness.EUWBNewBusinessOrchestrationServiceImpl] (EJB default - 4) URI scheme is not "file"
16:32:35,604 INFO  [au.com.aia.euwb.services.newbusiness.EUWBNewBusinessOrchestrationServiceImpl] (EJB default - 4) NewBusinessOrchestraService WS call to preview SAT letter - ended.
16:32:35,604 INFO  [au.com.aia.euwb.services.life.proposals.requirements.esb.outbound.service.job.EsbOutboundJobServiceImpl] (EJB default - 4) *******esb*******processEsbOutboundCall: Exception caught
16:32:35,605 INFO  [au.com.aia.euwb.services.life.proposals.requirements.EUWBRequirementServiceImpl] (EJB default - 4) *******esb*******handleEsbExceptionalRequirement: started
16:32:35,606 WARN  [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (EJB default - 4) SQL Error: 0, SQLState: null
16:32:35,606 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (EJB default - 4) javax.resource.ResourceException: IJ000460: Error checking for a transaction
16:32:35,606 ERROR [com.axelerator.platform.foundation.operations.ejb.timers.OperationsEJBTimer] (EJB default - 4) Operations job 'eUWB ESB Outbound Synch Processing' failed; details: org.hibernate.exception.GenericJDBCException: Could not open connection
16:32:35,608 WARN  [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (EJB default - 4) SQL Error: 0, SQLState: null
16:32:35,608 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (EJB default - 4) javax.resource.ResourceException: IJ000460: Error checking for a transaction
16:32:35,608 INFO  [org.hibernate.event.internal.DefaultLoadEventListener] (EJB default - 4) HHH000327: Error performing load command : org.hibernate.exception.GenericJDBCException: Could not open connection
16:32:35,615 ERROR [org.jboss.as.ejb3] (EJB default - 4) JBAS014122: Error during retrying timeout for timer: [id=9c0f3b7a-6513-488a-a716-cae7664c3e65 timedObjectId=axelerator-project-admin-app-14.3.5-SNAPSHOT.euwb-operations-ejb-14.3.5-SNAPSHOT.ExecuteEUWBESBOutboundSynchBean auto-timer?:false persistent?:true timerService=org.jboss.as.ejb3.timerservice.TimerServiceImpl@775989be initialExpiration=Fri Apr 03 16:32:32 AEDT 2020 intervalDuration(in milli sec)=0 nextExpiration=null timerState=RETRY_TIMEOUT info=euwb/executeEUWBESBOutboundSynch:MANUAL]: javax.ejb.EJBException: org.hibernate.exception.GenericJDBCException: Could not open connection
    at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java:191) [jboss-as-ejb3-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
    at org.jboss.as.ejb3.tx.TimerCMTTxInterceptor.handleExceptionInOurTx(TimerCMTTxInterceptor.java:53) [jboss-as-ejb3-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
    at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:282) [jboss-as-ejb3-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
    at org.jboss.as.ejb3.tx.CMTTxInterceptor.requiresNew(CMTTxInterceptor.java:367) [jboss-as-ejb3-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
    at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:245) [jboss-as-ejb3-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
    at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [jboss-as-ejb3-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
    at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory.processInvocation(ShutDownInterceptorFactory.java:64) [jboss-as-ejb3-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
    at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) [jboss-as-ee-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
    at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:55) [jboss-as-ejb3-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
    at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45) [jboss-as-ee-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
    at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
    at org.jboss.as.ejb3.timerservice.TimedObjectInvokerImpl.callTimeout(TimedObjectInvokerImpl.java:101) [jboss-as-ejb3-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
    at org.jboss.as.ejb3.timerservice.TimedObjectInvokerImpl.callTimeout(TimedObjectInvokerImpl.java:111) [jboss-as-ejb3-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
    at org.jboss.as.ejb3.timerservice.task.TimerTask.callTimeout(TimerTask.java:187) [jboss-as-ejb3-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
    at org.jboss.as.ejb3.timerservice.task.TimerTask.retryTimeout(TimerTask.java:210) [jboss-as-ejb3-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
    at org.jboss.as.ejb3.timerservice.task.TimerTask.run(TimerTask.java:167) [jboss-as-ejb3-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [rt.jar:1.8.0_131]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [rt.jar:1.8.0_131]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_131]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_131]
    at java.lang.Thread.run(Thread.java:748) [rt.jar:1.8.0_131]
    at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.1.2.Final-redhat-1.jar:2.1.2.Final-redhat-1]
Caused by: org.hibernate.exception.GenericJDBCException: Could not open connection
    at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:54) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
    at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:124) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
    at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:109) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
    at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:221) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
    at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.getConnection(LogicalConnectionImpl.java:157) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
    at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.connection(StatementPreparerImpl.java:56) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
    at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.doPrepare(StatementPreparerImpl.java:159) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
    at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:183) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
    at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareQueryStatement(StatementPreparerImpl.java:157) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
    at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1881) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
    at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1858) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
    at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1838) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
    at org.hibernate.loader.Loader.doQuery(Loader.java:906) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
    at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:348) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
    at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:318) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
    at org.hibernate.loader.Loader.loadEntity(Loader.java:2145) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
    at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:82) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
    at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:72) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
    at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3939) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
    at org.hibernate.event.internal.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:462) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
    at org.hibernate.event.internal.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:431) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
    at org.hibernate.event.internal.DefaultLoadEventListener.load(DefaultLoadEventListener.java:208) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
    at org.hibernate.event.internal.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:264) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
    at org.hibernate.event.internal.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:152) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
    at org.hibernate.internal.SessionImpl.fireLoad(SessionImpl.java:1053) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
    at org.hibernate.internal.SessionImpl.access00(SessionImpl.java:173) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
    at org.hibernate.internal.SessionImpl$IdentifierLoadAccessImpl.load(SessionImpl.java:2449) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
    at org.hibernate.internal.SessionImpl.get(SessionImpl.java:953) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
    at org.hibernate.event.internal.DefaultMergeEventListener.entityIsDetached(DefaultMergeEventListener.java:300) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
    at org.hibernate.event.internal.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:180) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
    at org.hibernate.event.internal.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:86) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
    at org.hibernate.internal.SessionImpl.fireMerge(SessionImpl.java:833) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
    at org.hibernate.internal.SessionImpl.merge(SessionImpl.java:817) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
    at org.hibernate.internal.SessionImpl.merge(SessionImpl.java:821) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
    at com.axelerator.platform.foundation.operations.services.jobs.OperationsJobServiceImpl.updateOperationsJobCurrentState(OperationsJobServiceImpl.java:129)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_131]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [rt.jar:1.8.0_131]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_131]
    at java.lang.reflect.Method.invoke(Method.java:498) [rt.jar:1.8.0_131]
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:302)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
    at org.springframework.transaction.interceptor.TransactionInterceptor.proceedWithInvocation(TransactionInterceptor.java:99)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208)
    at com.sun.proxy.$Proxy871.updateOperationsJobCurrentState(Unknown Source)
    at com.axelerator.platform.foundation.operations.ejb.timers.OperationsEJBTimer.afterJobExecution(OperationsEJBTimer.java:464)
    at com.axelerator.platform.foundation.operations.ejb.timers.OperationsEJBTimer.ejbTimeout(OperationsEJBTimer.java:235)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_131]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [rt.jar:1.8.0_131]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_131]
    at java.lang.reflect.Method.invoke(Method.java:498) [rt.jar:1.8.0_131]
    at org.jboss.as.ee.component.ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptor.java:52) [jboss-as-ee-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
    at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
    at org.jboss.as.ee.component.interceptors.UserInterceptorFactory.processInvocation(UserInterceptorFactory.java:61) [jboss-as-ee-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
    at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
    at org.jboss.as.ee.component.interceptors.UserInterceptorFactory.processInvocation(UserInterceptorFactory.java:61) [jboss-as-ee-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
    at org.jboss.as.ejb3.component.invocationmetrics.ExecutionTimeInterceptor.processInvocation(ExecutionTimeInterceptor.java:43) [jboss-as-ejb3-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
    at org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:47)
    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
    at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
    at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
    at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:53) [jboss-as-ee-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
    at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51) [jboss-as-ejb3-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
    at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:280) [jboss-as-ejb3-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
    ... 25 more
Caused by: java.sql.SQLException: javax.resource.ResourceException: IJ000460: Error checking for a transaction
    at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:151)
    at org.hibernate.service.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:141) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
    at org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.java:301) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
    at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:214) [hibernate-core-4.2.18.Final-redhat-2.jar:4.2.18.Final-redhat-2]
    ... 95 more
Caused by: javax.resource.ResourceException: IJ000460: Error checking for a transaction
    at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:362)
    at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:510)
    at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:143)
    ... 98 more
Caused by: javax.resource.ResourceException: IJ000459: Transaction is not active: tx=TransactionImple < ac, BasicAction: 0:ffffc0a86301:5c0befd5:5e86c9fc:ba status: ActionStatus.ABORT_ONLY >
    at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:352)
    ... 100 more


唯一的可能性应该是,当 EJB class 调用 method() 时,EJB class 中已经打开了一个事务,导致了所描述的行为。