0 Replies Latest reply on May 28, 2008 9:41 PM by Joe Dean

    Help with transactions in HomeObjects

    Joe Dean Newbie

      I'm stuck on the following problem.  Any help / pointers would be greatly appreciated!!!


      I have a class that extends EntityHome called PostingHome.  This class has a createPosting method that is annotated as Transactional.  When the method completes I get the following exception.


      INFO  [com.onsitemanager.accounting.session.eao.PostingHome] Second posting saved succesfully to the DB.
      ERROR [org.jboss.aspects.tx.TxPolicy] IllegalStateException while setting transaction for rollback only
      java.lang.IllegalStateException: [com.arjuna.ats.internal.jta.transaction.arjunacore.inactive] [com.arjuna.ats.internal.jta.transaction.arjunacore.inactive] The transaction is not active!
           at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.setRollbackOnly(TransactionImple.java:380)
           at org.jboss.aspects.tx.TxPolicy.setRollbackOnly(TxPolicy.java:212)
           at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:81)
           at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:130)
           at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:197)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
           at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
           at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:86)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
           at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
           at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:166)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
           at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
           at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
           at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:261)
           at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:119)
           at $Proxy104.retrieveUndepositedPayments(Unknown Source)
           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:585)
           at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
           at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
           at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:76)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
           at org.jboss.seam.ejb.RemoveInterceptor.aroundInvoke(RemoveInterceptor.java:41)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
           at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
           at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:54)
           at org.javassist.tmp.java.lang.Object_$$_javassist_12.retrieveUndepositedPayments(Object_$$_javassist_12.java)
           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:585)
           at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
           at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:125)
           at org.jboss.seam.Component.callComponentMethod(Component.java:2082)
           at org.jboss.seam.core.Events.raiseEvent(Events.java:84)
           at org.jboss.seam.async.AsynchronousEvent.call(AsynchronousEvent.java:27)
           at org.jboss.seam.async.Asynchronous.executeInContexts(Asynchronous.java:76)
           at org.jboss.seam.async.Asynchronous.execute(Asynchronous.java:45)
           at org.jboss.seam.async.TransactionSuccessEvent.afterCompletion(TransactionSuccessEvent.java:24)
           at org.jboss.seam.transaction.SynchronizationRegistry.afterTransactionCompletion(SynchronizationRegistry.java:42)
           at org.jboss.seam.transaction.EjbSynchronizations.afterCompletion(EjbSynchronizations.java:80)
           at org.jboss.ejb3.stateful.SessionSynchronizationInterceptor$SFSBSessionSynchronization.afterCompletion(SessionSynchronizationInterceptor.java:87)
           at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.afterCompletion(SynchronizationImple.java:136)
           at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.afterCompletion(TwoPhaseCoordinator.java:343)
           at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:93)
           at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:177)
           at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1389)
           at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:135)
           at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:87)
           at org.jboss.embedded.adapters.LocalOnlyUserTransaction.commit(LocalOnlyUserTransaction.java:96)
           at org.jboss.seam.transaction.UTTransaction.commit(UTTransaction.java:52)
           at org.jboss.seam.util.Work.workInTransaction(Work.java:44)
           at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:32)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
           at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
           at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
           at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:166)
           at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:102)
           at com.onsitemanager.accounting.session.eao.PostingHome_$$_javassist_7.createPosting(PostingHome_$$_javassist_7.java)
           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:585)
           at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:329)
           at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:342)
           at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
           at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
           at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
           at org.jboss.seam.core.Expressions$2.invoke(Expressions.java:173)
           at org.jboss.seam.mock.BaseSeamTest$ComponentTest.invokeMethod(BaseSeamTest.java:143)
           at com.onsitemanager.accounting.session.eao.test.CreatePostingTest$1.testComponents(CreatePostingTest.java:68)
           at org.jboss.seam.mock.BaseSeamTest$ComponentTest.run(BaseSeamTest.java:169)
           at com.onsitemanager.accounting.session.eao.test.CreatePostingTest.testCreatePosting(CreatePostingTest.java:90)
           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:585)
           at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:580)
           at org.testng.internal.Invoker.invokeMethod(Invoker.java:478)
           at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:607)
           at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:874)
           at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
           at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
           at org.testng.TestRunner.runWorkers(TestRunner.java:689)
           at org.testng.TestRunner.privateRun(TestRunner.java:566)
           at org.testng.TestRunner.run(TestRunner.java:466)
           at org.testng.SuiteRunner.runTest(SuiteRunner.java:301)
           at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:296)
           at org.testng.SuiteRunner.privateRun(SuiteRunner.java:276)
           at org.testng.SuiteRunner.run(SuiteRunner.java:191)
           at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:808)
           at org.testng.TestNG.runSuitesLocally(TestNG.java:776)
           at org.testng.TestNG.run(TestNG.java:701)
           at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73)
           at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:124)
      ERROR [org.jboss.aspects.tx.TxPolicy] javax.ejb.EJBTransactionRolledbackException: No active JTA transaction on joinTransaction call
      ERROR [org.jboss.seam.transaction.SynchronizationRegistry] Exception processing transaction Synchronization after completion
      javax.ejb.EJBTransactionRolledbackException: No active JTA transaction on joinTransaction call
           at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:91)
           at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:130)
           at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:197)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
           at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
           at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:86)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
           at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
           at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:166)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
           at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
           at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
           at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:261)
           at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:119)
           at $Proxy104.retrieveUndepositedPayments(Unknown Source)
           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:585)
           at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
           at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
           at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:76)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
           at org.jboss.seam.ejb.RemoveInterceptor.aroundInvoke(RemoveInterceptor.java:41)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
           at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
           at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:54)
           at org.javassist.tmp.java.lang.Object_$$_javassist_12.retrieveUndepositedPayments(Object_$$_javassist_12.java)
           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:585)
           at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
           at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:125)
           at org.jboss.seam.Component.callComponentMethod(Component.java:2082)
           at org.jboss.seam.core.Events.raiseEvent(Events.java:84)
           at org.jboss.seam.async.AsynchronousEvent.call(AsynchronousEvent.java:27)
           at org.jboss.seam.async.Asynchronous.executeInContexts(Asynchronous.java:76)
           at org.jboss.seam.async.Asynchronous.execute(Asynchronous.java:45)
           at org.jboss.seam.async.TransactionSuccessEvent.afterCompletion(TransactionSuccessEvent.java:24)
           at org.jboss.seam.transaction.SynchronizationRegistry.afterTransactionCompletion(SynchronizationRegistry.java:42)
           at org.jboss.seam.transaction.EjbSynchronizations.afterCompletion(EjbSynchronizations.java:80)
           at org.jboss.ejb3.stateful.SessionSynchronizationInterceptor$SFSBSessionSynchronization.afterCompletion(SessionSynchronizationInterceptor.java:87)
           at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.afterCompletion(SynchronizationImple.java:136)
           at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.afterCompletion(TwoPhaseCoordinator.java:343)
           at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:93)
           at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:177)
           at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1389)
           at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:135)
           at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:87)
           at org.jboss.embedded.adapters.LocalOnlyUserTransaction.commit(LocalOnlyUserTransaction.java:96)
           at org.jboss.seam.transaction.UTTransaction.commit(UTTransaction.java:52)
           at org.jboss.seam.util.Work.workInTransaction(Work.java:44)
           at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:32)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
           at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
           at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
           at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:166)
           at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:102)
           at com.onsitemanager.accounting.session.eao.PostingHome_$$_javassist_7.createPosting(PostingHome_$$_javassist_7.java)
           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:585)
           at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:329)
           at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:342)
           at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
           at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
           at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
           at org.jboss.seam.core.Expressions$2.invoke(Expressions.java:173)
           at org.jboss.seam.mock.BaseSeamTest$ComponentTest.invokeMethod(BaseSeamTest.java:143)
           at com.onsitemanager.accounting.session.eao.test.CreatePostingTest$1.testComponents(CreatePostingTest.java:68)
           at org.jboss.seam.mock.BaseSeamTest$ComponentTest.run(BaseSeamTest.java:169)
           at com.onsitemanager.accounting.session.eao.test.CreatePostingTest.testCreatePosting(CreatePostingTest.java:90)
           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:585)
           at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:580)
           at org.testng.internal.Invoker.invokeMethod(Invoker.java:478)
           at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:607)
           at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:874)
           at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
           at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
           at org.testng.TestRunner.runWorkers(TestRunner.java:689)
           at org.testng.TestRunner.privateRun(TestRunner.java:566)
           at org.testng.TestRunner.run(TestRunner.java:466)
           at org.testng.SuiteRunner.runTest(SuiteRunner.java:301)
           at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:296)
           at org.testng.SuiteRunner.privateRun(SuiteRunner.java:276)
           at org.testng.SuiteRunner.run(SuiteRunner.java:191)
           at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:808)
           at org.testng.TestNG.runSuitesLocally(TestNG.java:776)
           at org.testng.TestNG.run(TestNG.java:701)
           at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73)
           at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:124)



      My components.xml has the following line:


      <transaction:ejb-transaction/>




      Here's my class



      @Name("postingHome")
      public class PostingHome extends EntityHome<Posting> {
      
      @Transactional
           public String createPosting() {
                validatePropertyHomeIsSet();
                
           // business logic that uses this.persist() a bunch of times
                return "success";
           }
      }
      



      Anyone have any thoughts for me?  Do I need to configure JTA ?   I'm using Seam 2.0.1GA and JBoss 4.2.2.GA