2 Replies Latest reply on Nov 15, 2011 2:03 PM by Vitaly Masterov

    Shared use of Seam Cron and @TransactionAttribute throws Exception

    Vitaly Masterov Newbie

      My environment:



      • Jboss AS 7.0.2

      • Seam 3.1.0-SNAPSHOT



      If I use seam-cron in the bean that is declared as @TransactionAttribute, when I call any method I get (java.lang.UnsupportedOperationException: no transaction),
      even if the method body does not use EntityManager.


      The method I am calling is declared as


      public void doImport(@Observes @Every(Interval.HOUR) Trigger trigger) {...} .



      TransactionInterceptor is declared in beans.xml. Any method without seam-cron annotations works fine and persist operation is successfull.


      Full StackTrace:


      10:34:45,258 ERROR [org.quartz.core.JobRunShell] (SimpleThreadPoolWorker-1) Job DEFAULT.org.jboss.seam.cron.spi.scheduling.trigger.IntervalTriggerDetail{, qualifier=@org.jboss.seam.cron.api.scheduling.Every(nth=1, value=HOUR), repeatUnit=HOUR, repeatInterval=1}-trigger threw an unhandled Exception: : java.lang.UnsupportedOperationException: no transaction
              at org.jboss.seam.transaction.NoTransaction.begin(NoTransaction.java:43) [seam-transaction-3.1.0-SNAPSHOT.jar:]
              at org.jboss.seam.transaction.DefaultSeamTransaction.begin(DefaultSeamTransaction.java:87) [seam-transaction-3.1.0-SNAPSHOT.jar:]
              at org.jboss.seam.transaction.Work.workInTransaction(Work.java:46) [seam-transaction-3.1.0-SNAPSHOT.jar:]
              at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:148) [seam-transaction-3.1.0-SNAPSHOT.jar:]
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.7.0_01]
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [:1.7.0_01]
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [:1.7.0_01]
              at java.lang.reflect.Method.invoke(Method.java:601) [:1.7.0_01]
              at org.jboss.interceptor.proxy.InterceptorInvocation$InterceptorMethodInvocation.invoke(InterceptorInvocation.java:72) [jboss-interceptor-core-2.0.0.Alpha3.jar:2.0.0.Alpha3]
              at org.jboss.interceptor.proxy.SimpleInterceptionChain.invokeNextInterceptor(SimpleInterceptionChain.java:82) [jboss-interceptor-core-2.0.0.Alpha3.jar:2.0.0.Alpha3]
              at org.jboss.interceptor.proxy.InterceptorMethodHandler.executeInterception(InterceptorMethodHandler.java:133) [jboss-interceptor-core-2.0.0.Alpha3.jar:2.0.0.Alpha3]
              at org.jboss.interceptor.proxy.InterceptorMethodHandler.invoke(InterceptorMethodHandler.java:112) [jboss-interceptor-core-2.0.0.Alpha3.jar:2.0.0.Alpha3]
              at org.jboss.weld.bean.proxy.CombinedInterceptorAndDecoratorStackMethodHandler.invoke(CombinedInterceptorAndDecoratorStackMethodHandler.java:65) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
              at ru.mugitus.ee.social.twitter.239959979$Proxy$_$$_WeldSubclass.doImport(239959979$Proxy$_$$_WeldSubclass.java) [ee-social-1.0-SNAPSHOT.jar:]
              at ru.mugitus.ee.social.twitter.TwitterTimelineImporter$Proxy$_$$_WeldClientProxy.doImport(TwitterTimelineImporter$Proxy$_$$_WeldClientProxy.java) [ee-social-1.0-SNAPSHOT.jar:]
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.7.0_01]
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [:1.7.0_01]
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [:1.7.0_01]
              at java.lang.reflect.Method.invoke(Method.java:601) [:1.7.0_01]
              at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:305) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
              at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
              at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:163) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
              at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:299) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
              at org.jboss.weld.introspector.jlr.WeldMethodImpl.invokeOnInstance(WeldMethodImpl.java:188) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
              at org.jboss.weld.introspector.ForwardingWeldMethod.invokeOnInstance(ForwardingWeldMethod.java:59) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
              at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:198) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
              at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:282) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
              at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:265) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
              at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:234) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
              at org.jboss.weld.manager.BeanManagerImpl.notifyObservers(BeanManagerImpl.java:635) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
              at org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:622) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
              at org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:616) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
              at org.jboss.seam.cron.spi.scheduling.trigger.TriggerSupport.fireTrigger(TriggerSupport.java:96) [seam-cron-spi-3.1.0-SNAPSHOT.jar:]
              at org.jboss.seam.cron.spi.scheduling.trigger.ProviderContextTriggerSupport.fireTrigger(ProviderContextTriggerSupport.java:61) [seam-cron-spi-3.1.0-SNAPSHOT.jar:]
              at org.jboss.seam.cron.scheduling.quartz.TriggerJob.execute(TriggerJob.java:49) [seam-cron-scheduling-quartz-3.1.0-SNAPSHOT.jar:]
              at org.quartz.core.JobRunShell.run(JobRunShell.java:202) [quartz-1.6.1.jar:]
              at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525) [quartz-1.6.1.jar:]
      
      10:34:45,266 ERROR [org.quartz.core.ErrorLogger] (SimpleThreadPoolWorker-1) Job (DEFAULT.org.jboss.seam.cron.spi.scheduling.trigger.IntervalTriggerDetail{, qualifier=@org.jboss.seam.cron.api.scheduling.Every(nth=1, value=HOUR), repeatUnit=HOUR, repeatInterval=1}-trigger threw an exception.: org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: java.lang.UnsupportedOperationException: no transaction]
              at org.quartz.core.JobRunShell.run(JobRunShell.java:213) [quartz-1.6.1.jar:]
              at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525) [quartz-1.6.1.jar:]
      Caused by: java.lang.UnsupportedOperationException: no transaction
              at org.jboss.seam.transaction.NoTransaction.begin(NoTransaction.java:43) [seam-transaction-3.1.0-SNAPSHOT.jar:]
              at org.jboss.seam.transaction.DefaultSeamTransaction.begin(DefaultSeamTransaction.java:87) [seam-transaction-3.1.0-SNAPSHOT.jar:]
              at org.jboss.seam.transaction.Work.workInTransaction(Work.java:46) [seam-transaction-3.1.0-SNAPSHOT.jar:]
              at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:148) [seam-transaction-3.1.0-SNAPSHOT.jar:]
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.7.0_01]
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [:1.7.0_01]
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [:1.7.0_01]
              at java.lang.reflect.Method.invoke(Method.java:601) [:1.7.0_01]
              at org.jboss.interceptor.proxy.InterceptorInvocation$InterceptorMethodInvocation.invoke(InterceptorInvocation.java:72) [jboss-interceptor-core-2.0.0.Alpha3.jar:2.0.0.Alpha3]
              at org.jboss.interceptor.proxy.SimpleInterceptionChain.invokeNextInterceptor(SimpleInterceptionChain.java:82) [jboss-interceptor-core-2.0.0.Alpha3.jar:2.0.0.Alpha3]
              at org.jboss.interceptor.proxy.InterceptorMethodHandler.executeInterception(InterceptorMethodHandler.java:133) [jboss-interceptor-core-2.0.0.Alpha3.jar:2.0.0.Alpha3]
              at org.jboss.interceptor.proxy.InterceptorMethodHandler.invoke(InterceptorMethodHandler.java:112) [jboss-interceptor-core-2.0.0.Alpha3.jar:2.0.0.Alpha3]
              at org.jboss.weld.bean.proxy.CombinedInterceptorAndDecoratorStackMethodHandler.invoke(CombinedInterceptorAndDecoratorStackMethodHandler.java:65) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
              at ru.mugitus.ee.social.twitter.239959979$Proxy$_$$_WeldSubclass.doImport(239959979$Proxy$_$$_WeldSubclass.java) [ee-social-1.0-SNAPSHOT.jar:]
              at ru.mugitus.ee.social.twitter.TwitterTimelineImporter$Proxy$_$$_WeldClientProxy.doImport(TwitterTimelineImporter$Proxy$_$$_WeldClientProxy.java) [ee-social-1.0-SNAPSHOT.jar:]
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.7.0_01]
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [:1.7.0_01]
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [:1.7.0_01]
              at java.lang.reflect.Method.invoke(Method.java:601) [:1.7.0_01]
              at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:305) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
              at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
              at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:163) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
              at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:299) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
              at org.jboss.weld.introspector.jlr.WeldMethodImpl.invokeOnInstance(WeldMethodImpl.java:188) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
              at org.jboss.weld.introspector.ForwardingWeldMethod.invokeOnInstance(ForwardingWeldMethod.java:59) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
              at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:198) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
              at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:282) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
              at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:265) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
              at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:234) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
              at org.jboss.weld.manager.BeanManagerImpl.notifyObservers(BeanManagerImpl.java:635) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
              at org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:622) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
              at org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:616) [weld-core-1.1.2.Final.jar:2011-07-26 15:02]
              at org.jboss.seam.cron.spi.scheduling.trigger.TriggerSupport.fireTrigger(TriggerSupport.java:96) [seam-cron-spi-3.1.0-SNAPSHOT.jar:]
              at org.jboss.seam.cron.spi.scheduling.trigger.ProviderContextTriggerSupport.fireTrigger(ProviderContextTriggerSupport.java:61) [seam-cron-spi-3.1.0-SNAPSHOT.jar:]
              at org.jboss.seam.cron.scheduling.quartz.TriggerJob.execute(TriggerJob.java:49) [seam-cron-scheduling-quartz-3.1.0-SNAPSHOT.jar:]
              at org.quartz.core.JobRunShell.run(JobRunShell.java:202) [quartz-1.6.1.jar:]
              ... 1 more
      
      



      I think this is a bag.