9 Replies Latest reply on Feb 25, 2011 3:40 AM by jaikiran

    @TransactionManagement doesn't work in JBoss 6 Final

    fidox

      Hello. I have an issue with jboss-6.0.0.Final: I can't set the transaction management to Bean in a Stateless EJB.

       

      In deep, I have an ejb with Restful annotations. I have a function that doesn't use database. It's only used to upload files to the server. So my idea is set this ejb to BMT to avoid transactions timeouts where transactions are not used.

       

      This work successfully in JBoss 5. But in JBoss 6 using:

       

      @TransactionManagement(TransactionManagementType.BEAN)

       

      Doesn't have any effect. The EJB continue using CMT. As you can see in tracelog of timeout exception:

       

      Caused by: javax.ejb.EJBTransactionRolledbackException: Transaction rolled back

              at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.handleEndTransactionException(CMTTxInterceptor.java:115) [:0.0.1]

              at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.endTransaction(CMTTxInterceptor.java:87) [:0.0.1]

              at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:255) [:0.0.1]

              at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.required(CMTTxInterceptor.java:349) [:0.0.1]

              at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.invoke(CMTTxInterceptor.java:209) [:0.0.1]

              at org.jboss.ejb3.tx2.aop.CMTTxInterceptorWrapper.invoke(CMTTxInterceptorWrapper.java:52) [:0.0.1]

       

      This is the class Im using to test:

       

      @Stateless

      @Local(TestTransactionManagement.class)

      @TransactionManagement(TransactionManagementType.BEAN)

      @TransactionTimeout(value=10)

      public class TestTransactionManagementImpl implements TestTransactionManagement {

           public String test(int timeout) {

           try {

                Thread.sleep(timeout);

           } catch (InterruptedException e) {

                e.printStackTrace();

           }

           return "OK";

           }

      }

       

      As I understand. This class cannot throw a TransactionTimeoutException because there is no transactions active. But the exception occurs and in the stracktrace you can see classess referencing to CMT which is not correct because I have switched off with TransactionManagementType.BEAN

       

      How can I set BMT in this EJB and avoid TransactionTimeout exceptions?

       

      I have attached a sample you can reproduce the error. Run the build.sh and access to:

       

      http://localhost:8080/test-war/test/12000/

       

       

       

      Greetings.

        • 1. @TransactionManagement doesn't work in JBoss 6 Final
          fidox

          Really? Its not possible to set transaction management to BEAN ??

          • 2. @TransactionManagement doesn't work in JBoss 6 Final
            jaikiran

            Israel, you posted in the wrong forum and that's probably why no one responded. I'll move it to our EJB3 forum and we can discuss it there.

            • 3. @TransactionManagement doesn't work in JBoss 6 Final
              jaikiran

              I haven't yet checked the attached application (will do in a while). But can you please post the entire exception stacktrace and also the client code which invokes the bean?

              • 4. @TransactionManagement doesn't work in JBoss 6 Final
                fidox

                Thanks a lot, jaikiran!

                 

                I've not invoking the bean using a client. Im using restful annotations and invoking the client by calling the bean url using a navigator. This is the web.xml Im using for that:

                <!DOCTYPE web-app PUBLIC

                        "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"

                        "http://java.sun.com/dtd/web-app_2_3.dtd" >

                <web-app>

                   <display-name>Archetype Created Web Application</display-name>

                   <context-param>

                      <param-name>resteasy.jndi.resources</param-name>

                      <param-value>test-bmt/TestTransactionManagementImpl/local

                      </param-value>

                   </context-param>

                 

                   <listener>

                      <listener-class>org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>

                   </listener>

                   <servlet>

                      <servlet-name>Resteasy</servlet-name>

                      <servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>

                   </servlet>

                   <servlet-mapping>

                      <servlet-name>Resteasy</servlet-name>

                      <url-pattern>/*</url-pattern>

                   </servlet-mapping>

                </web-app>

                 

                 

                This is the entire stacktrace:

                 

                2011-02-22 13:37:40,942 WARN  [com.arjuna.ats.arjuna] (Transaction Reaper) ARJUNA-12117 TransactionReaper::check timeout for TX 0:ffffc0a814d4:126a:4d5e6cc5:eb5e in state  RUN

                2011-02-22 13:37:40,953 WARN  [com.arjuna.ats.arjuna] (Transaction Reaper Worker 0) ARJUNA-12121 TransactionReaper::doCancellations worker Thread[Transaction Reaper Worker 0,5,jboss] successfully canceled TX 0:ffffc0a814d4:126a:4d5e6cc5:eb5e

                2011-02-22 13:37:42,942 WARN  [com.arjuna.ats.arjuna] (http-192.168.20.212-8080-1) ARJUNA-12077 Abort called on already aborted atomic action 0:ffffc0a814d4:126a:4d5e6cc5:eb5e

                2011-02-22 13:37:42,945 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/test-war].[Resteasy]] (http-192.168.20.212-8080-1) Servlet.service() para servlet Resteasy lanzó excepción: org.jboss.resteasy.spi.UnhandledException: javax.ejb.EJBTransactionRolledbackException: Transaction rolled back

                        at org.jboss.resteasy.core.SynchronousDispatcher.unwrapException(SynchronousDispatcher.java:329) [:6.0.0.Final]

                        at org.jboss.resteasy.core.SynchronousDispatcher.handleApplicationException(SynchronousDispatcher.java:305) [:6.0.0.Final]

                        at org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:198) [:6.0.0.Final]

                        at org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:174) [:6.0.0.Final]

                        at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:518) [:6.0.0.Final]

                        at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:480) [:6.0.0.Final]

                        at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119) [:6.0.0.Final]

                        at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:207) [:6.0.0.Final]

                        at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) [:6.0.0.Final]

                        at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) [:6.0.0.Final]

                        at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [:1.0.0.Final]

                        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:324) [:6.0.0.Final]

                        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.0.0.Final]

                        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [:6.0.0.Final]

                        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) [:6.0.0.Final]

                        at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:181) [:6.0.0.Final]

                        at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.event(CatalinaContext.java:285) [:1.1.0.Final]

                        at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.invoke(CatalinaContext.java:261) [:1.1.0.Final]

                        at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:88) [:6.0.0.Final]

                        at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:100) [:6.0.0.Final]

                        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) [:6.0.0.Final]

                        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [:6.0.0.Final]

                        at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158) [:6.0.0.Final]

                        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [:6.0.0.Final]

                        at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.invoke(ActiveRequestResponseCacheValve.java:53) [:6.0.0.Final]

                        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [:6.0.0.Final]

                        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [:6.0.0.Final]

                        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:654) [:6.0.0.Final]

                        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951) [:6.0.0.Final]

                        at java.lang.Thread.run(Thread.java:662) [:1.6.0_22]

                Caused by: javax.ejb.EJBTransactionRolledbackException: Transaction rolled back

                        at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.handleEndTransactionException(CMTTxInterceptor.java:115) [:0.0.1]

                        at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.endTransaction(CMTTxInterceptor.java:87) [:0.0.1]

                        at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:255) [:0.0.1]

                        at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.required(CMTTxInterceptor.java:349) [:0.0.1]

                        at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.invoke(CMTTxInterceptor.java:209) [:0.0.1]

                        at org.jboss.ejb3.tx2.aop.CMTTxInterceptorWrapper.invoke(CMTTxInterceptorWrapper.java:52) [:0.0.1]

                        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.GA]

                        at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76) [:1.0.0.GA]

                        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.GA]

                        at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42) [:1.0.3]

                        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.GA]

                        at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:182) [:1.7.17]

                        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.GA]

                        at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:41) [:1.7.17]

                        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.GA]

                        at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67) [:1.7.17]

                        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.GA]

                        at org.jboss.ejb3.core.context.CurrentInvocationContextInterceptor.invoke(CurrentInvocationContextInterceptor.java:47) [:1.7.17]

                        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.GA]

                        at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67) [:1.0.1]

                        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.GA]

                        at org.jboss.ejb3.interceptor.EJB3TCCLInterceptor.invoke(EJB3TCCLInterceptor.java:86) [:1.7.17]

                        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.GA]

                        at org.jboss.ejb3.session.SessionSpecContainer.invoke(SessionSpecContainer.java:323) [:1.7.17]

                        at org.jboss.ejb3.session.SessionSpecContainer.invoke(SessionSpecContainer.java:380) [:1.7.17]

                        at sun.reflect.GeneratedMethodAccessor313.invoke(Unknown Source) [:1.6.0_22]

                        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_22]

                        at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_22]

                        at org.jboss.ejb3.proxy.impl.handler.session.SessionLocalProxyInvocationHandler$LocalContainerInvocation.invokeTarget(SessionLocalProxyInvocationHandler.java:184) [:1.0.11]

                        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:111) [jboss-aop.jar:2.2.1.GA]

                        at org.jboss.ejb3.async.impl.interceptor.AsynchronousClientInterceptor.invoke(AsynchronousClientInterceptor.java:143) [:1.7.17]

                        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.GA]

                        at org.jboss.ejb3.proxy.impl.handler.session.SessionLocalProxyInvocationHandler$LocalInvokableContextHandler.invoke(SessionLocalProxyInvocationHandler.java:159) [:1.0.11]

                        at $Proxy210.invoke(Unknown Source)     at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:185) [:1.0.11]

                        at $Proxy701.test(Unknown Source)       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_22]

                        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_22]

                        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_22]

                        at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_22]

                        at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:140) [:6.0.0.Final]

                        at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:252) [:6.0.0.Final]

                        at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:217) [:6.0.0.Final]

                        at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:206) [:6.0.0.Final]

                        at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:503) [:6.0.0.Final]

                        ... 25 more

                Caused by: javax.transaction.RollbackException: ARJUNA-16063 The transaction is not active!

                        at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1148) [:6.0.0.Final]

                        at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:119) [:6.0.0.Final]

                        at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:75) [:6.0.0.Final]

                        at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.endTransaction(CMTTxInterceptor.java:82) [:0.0.1]

                        ... 68 more

                • 5. @TransactionManagement doesn't work in JBoss 6 Final
                  jaikiran

                  Hmm looking at our EJB3 code, this clearly is a (major) bug or I'm clearly missing something because I don't know how our tests would have missed this.

                   

                  Let me check some of our testcases for BEAN managed transactions.

                  • 6. Re: @TransactionManagement doesn't work in JBoss 6 Final
                    jaikiran

                    As a workaround, for now, try setting (in addition to the BEAN tx management type, that you already have):

                     

                    @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)

                     

                    on the bean implementation class

                    1 of 1 people found this helpful
                    • 7. @TransactionManagement doesn't work in JBoss 6 Final
                      jaikiran

                      Also, please file a JIRA here https://jira.jboss.org/browse/EJBTHREE

                      • 8. @TransactionManagement doesn't work in JBoss 6 Final
                        fidox
                        • 9. @TransactionManagement doesn't work in JBoss 6 Final
                          jaikiran

                          The fix for this is now available in JBoss AS nightly build http://community.jboss.org/thread/161386. You can give it a try against the latest build.