Why SLSB with TransactionAttributeType.NOT_SUPPORTED causing rollback of caller transaction ?

Solution Verified - Updated -

Issue

  • If a SLSB TestBean inherits a method from a POJO TestPojo, then a RuntimeException thrown in the inherited method TestPojo.failB() leads to a rollback of the caller transaction (EJBTransactionRolledbackException), despite TestBean having TransactionAttributeType.NOT_SUPPORTED.

  • This behavior is not as expected, failure inside TestBean should not affect the caller transaction.

  • The behavior is different/as-expected, if the inherited method TestPojo.failA() is overriden in TestBean. In this case, the caller transaction is not affected. We get an EJBException as following that can be compensated in the caller.

18:33:36,083 INFO  [stdout] (http-/127.0.0.1:8080-1) Jndi Lookup: "java:global/txEAPApp/txEJB/PersonBean!ejb.PersonIntegrationService"Succeeded. Got local : Proxy for view class: ejb.PersonIntegrationService of EJB: PersonBean
18:33:36,084 ERROR [org.jboss.as.ejb3.invocation] (http-/127.0.0.1:8080-1) JBAS014134: EJB Invocation failed on component TestBean for method public abstract void ejb.ForceFail.failA(): javax.ejb.EJBException: java.lang.RuntimeException: failA
    at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInNoTx(CMTTxInterceptor.java:215) [jboss-as-ejb3-7.4.2.Final-redhat-2.jar:7.4.2.Final-redhat-2]
    at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInNoTx(CMTTxInterceptor.java:261) [jboss-as-ejb3-7.4.2.Final-redhat-2.jar:7.4.2.Final-redhat-2]
    at org.jboss.as.ejb3.tx.CMTTxInterceptor.notSupported(CMTTxInterceptor.java:318) [jboss-as-ejb3-7.4.2.Final-redhat-2.jar:7.4.2.Final-redhat-2]
    at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:236) [jboss-as-ejb3-7.4.2.Final-redhat-2.jar:7.4.2.Final-redhat-2]
    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 ejb.ForceFail$$$view11.failA(Unknown Source) [testEJb.jar:]
    at ejb.PersonBean.testFailureHandling(Unknown Source) [testEJb.jar:]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_65]
.
.

Caused by: java.lang.RuntimeException: failA
    at ejb.TestPojo.failA(Unknown Source) [testEJb.jar:]
    at ejb.TestBean.failA(Unknown Source) [testEJb.jar:]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_65]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_65]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_65]
    at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_65]
    at org.jboss.as.ee.component.ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptor.java:52) [jboss-as-ee-7.4.2.Final-redhat-2.jar:7.4.2.Final-redhat-2]
    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$1.processInvocation(UserInterceptorFactory.java:63) [jboss-as-ee-7.4.2.Final-redhat-2.jar:7.4.2.Final-redhat-2]
    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.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51) [jboss-as-ejb3-7.4.2.Final-redhat-2.jar:7.4.2.Final-redhat-2]
    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.invokeInNoTx(CMTTxInterceptor.java:259) [jboss-as-ejb3-7.4.2.Final-redhat-2.jar:7.4.2.Final-redhat-2]
    ... 93 more

18:33:36,091 ERROR [org.jboss.as.ejb3] (http-/127.0.0.1:8080-1) javax.ejb.EJBTransactionRolledbackException: failB
18:33:36,091 ERROR [org.jboss.as.ejb3.invocation] (http-/127.0.0.1:8080-1) JBAS014134: EJB Invocation failed on component TestBean for method public abstract void ejb.ForceFail.failB(): javax.ejb.EJBTransactionRolledbackException: failB
    at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleInCallerTx(CMTTxInterceptor.java:162) [jboss-as-ejb3-7.4.2.Final-redhat-2.jar:7.4.2.Final-redhat-2]
    at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:252) [jboss-as-ejb3-7.4.2.Final-redhat-2.jar:7.4.2.Final-redhat-2]
    at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:341) [jboss-as-ejb3-7.4.2.Final-redhat-2.jar:7.4.2.Final-redhat-2]
    at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:238) [jboss-as-ejb3-7.4.2.Final-redhat-2.jar:7.4.2.Final-redhat-2]
    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 ejb.ForceFail$$$view11.failB(Unknown Source) [testEJb.jar:]
    at ejb.PersonBean.testFailureHandling(Unknown Source) [testEJb.jar:]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_65]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_65]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_65]
    at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_65]
    at org.jboss.as.ee.component.ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptor.java:52) [jboss-as-ee-7.4.2.Final-redhat-2.jar:7.4.2.Final-redhat-2]
    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.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [jboss-as-ejb3-7.4.2.Final-redhat-2.jar:7.4.2.Final-redhat-2]
    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.WaitTimeInterceptor.processInvocation(WaitTimeInterceptor.java:43) [jboss-as-ejb3-7.4.2.Final-redhat-2.jar:7.4.2.Final-redhat-2]
    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$1.processInvocation(ShutDownInterceptorFactory.java:64) [jboss-as-ejb3-7.4.2.Final-redhat-2.jar:7.4.2.Final-redhat-2]
    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.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59) [jboss-as-ejb3-7.4.2.Final-redhat-2.jar:7.4.2.Final-redhat-2]
    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.4.2.Final-redhat-2.jar:7.4.2.Final-redhat-2]
    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.4.2.Final-redhat-2.jar:7.4.2.Final-redhat-2]
    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
.
.
Caused by: java.lang.RuntimeException: failB
    at ejb.TestPojo.failB(Unknown Source) [testEJb.jar:]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_65]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_65]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_65]
    at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_65]
    at org.jboss.as.ee.component.ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptor.java:52) [jboss-as-ee-7.4.2.Final-redhat-2.jar:7.4.2.Final-redhat-2]
    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

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 6.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content