Transaction help in home object
joe May 19, 2008 1:51 PMGRRR - Let me try this again... I just typed up a complete post and got the following error message before I could submit:
HTTP Status 400 - Request failed, please check the application log or contact the administrator! (christian.bauer@gmail.com) type Status report message Request failed, please check the application log or contact the administrator! (christian.bauer@gmail.com) description The request sent by the client was syntactically incorrect (Request failed, please check the application log or contact the administrator! (christian.bauer@gmail.com)). JBossWeb/2.0.1.GA
Transactional Question - Take 2
I created a home object by extension. In this object I have a custom method that creates three records in the DB. One is record is created via a different home object and two records are created via the persist() method of this home object. This needs to all be done in a transaction. I annotate the method as @Transactional and everything works properly until the method completes. An error is thrown
DEBUG [com.arjuna.ats.jta.logging.logger] TransactionImple.getStatus DEBUG [com.arjuna.ats.jta.logging.logger] TransactionImple.setRollbackOnly 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_11.retrieveUndepositedPayments(Object_$$_javassist_11.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.PostingHomeEAO_$$_javassist_5.createPosting(PostingHomeEAO_$$_javassist_5.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:66) at org.jboss.seam.mock.BaseSeamTest$ComponentTest.run(BaseSeamTest.java:169) at com.onsitemanager.accounting.session.eao.test.CreatePostingTest.testCreatePosting(CreatePostingTest.java:88) 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 DEBUG [com.arjuna.ats.jta.logging.logger] TransactionImple.getStatus ERROR [org.jboss.seam.transaction.SynchronizationRegistry] Exception processing transaction Synchronization after completion javax.ejb.EJBTransactionRolledbackException: No active JTA transaction on joinTransaction call
What am I doing wrong? I did notice the following earlier in my logs...
2008-05-19 04:41:17,270 DEBUG [com.arjuna.ats.jta.logging.logger] SynchronizationImple.beforeCompletion 2008-05-19 04:41:17,270 DEBUG [com.arjuna.ats.arjuna.logging.arjLogger] BasicAction::End() for action-id -3f57fe55:ce6d:483166b3:85 2008-05-19 04:41:17,271 DEBUG [com.arjuna.ats.arjuna.logging.arjLogger] BasicAction::onePhaseCommit() for action-id -3f57fe55:ce6d:483166b3:85 2008-05-19 04:41:17,271 DEBUG [com.arjuna.ats.arjuna.logging.arjLogger] LastResourceRecord::topLevelPrepare() for 0:0:0:1 2008-05-19 04:41:17,271 DEBUG [com.arjuna.ats.arjuna.logging.arjLogger] LastResourceRecord::topLevelCommit() for 0:0:0:1 2008-05-19 04:41:17,271 DEBUG [com.arjuna.ats.jta.logging.logger] SynchronizationImple.afterCompletion 2008-05-19 04:41:17,272 DEBUG [com.arjuna.ats.jta.logging.logger] SynchronizationImple.afterCompletion
Has the home object already committed and completed the transaction when the persist() method is called in the super class? If so, how do I wrap my method into a different transaction? Am I using the home object incorrectly and need to create my own DAO CRUD component that manages these multiple inserts?