4 Replies Latest reply on Feb 11, 2008 11:54 PM by Andreas Franke

    Longrunning process

    Feivel Frey Newbie

      Hello,

      I have serveral long-runnig db-queries scheduled with a async call and a singleton messagedriven bean to execute this queries one-by-one.

      If there only a few queries in the queue all seems to be ok, but is this a large queue of queries I get the following exception:

      11:09:45,430 WARN [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.BasicAction_58] - Abort of action id -3f57fed1:4df:478f27c2:78 invoked while multiple threads active within it.
      11:09:45,430 WARN [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.CheckedAction_2] - CheckedAction::check - atomic action -3f57fed1:4df:478f27c2:78 aborting with 1 threads active!
      11:12:44,237 ERROR [STDERR] javax.persistence.TransactionRequiredException: EntityManager must be access within a transaction
      11:12:44,247 ERROR [STDERR] at org.jboss.ejb3.entity.ManagedEntityManagerFactory.verifyInTx(ManagedEntityManagerFactory.java:150)
      11:12:44,247 ERROR [STDERR] at org.jboss.ejb3.entity.TransactionScopedEntityManager.merge(TransactionScopedEntityManager.java:187)
      11:12:44,247 ERROR [STDERR] at org.jboss.seam.persistence.EntityManagerProxy.merge(EntityManagerProxy.java:130)
      11:12:44,247 ERROR [STDERR] at de.oats.datenvisualisierung.session.mdb.MySqlToORDbBean.query(MySqlToORDbBean.java:67)
      11:12:44,247 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      11:12:44,247 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      11:12:44,247 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      11:12:44,247 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
      11:12:44,247 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
      11:12:44,247 ERROR [STDERR] at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
      11:12:44,247 ERROR [STDERR] at org.jboss.seam.intercept.EJBInvocationContext.proceed(EJBInvocationContext.java:44)
      11:12:44,247 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
      11:12:44,257 ERROR [STDERR] at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
      11:12:44,257 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      11:12:44,257 ERROR [STDERR] at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
      11:12:44,257 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      11:12:44,257 ERROR [STDERR] at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
      11:12:44,257 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      11:12:44,257 ERROR [STDERR] at org.jboss.seam.persistence.EntityManagerProxyInterceptor.aroundInvoke(EntityManagerProxyInterceptor.java:26)
      11:12:44,257 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      11:12:44,257 ERROR [STDERR] at org.jboss.seam.persistence.HibernateSessionProxyInterceptor.aroundInvoke(HibernateSessionProxyInterceptor.java:27)
      11:12:44,257 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      11:12:44,257 ERROR [STDERR] at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:106)
      11:12:44,257 ERROR [STDERR] at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:50)
      11:12:44,257 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      11:12:44,257 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      11:12:44,257 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      11:12:44,257 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
      11:12:44,257 ERROR [STDERR] at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
      11:12:44,257 ERROR [STDERR] at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
      11:12:44,257 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      11:12:44,257 ERROR [STDERR] at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
      11:12:44,257 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      11:12:44,257 ERROR [STDERR] at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
      11:12:44,257 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      11:12:44,257 ERROR [STDERR] at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
      11:12:44,257 ERROR [STDERR] at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:195)
      11:12:44,257 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      11:12:44,257 ERROR [STDERR] at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
      11:12:44,257 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      11:12:44,257 ERROR [STDERR] at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
      11:12:44,257 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      11:12:44,257 ERROR [STDERR] at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
      11:12:44,257 ERROR [STDERR] at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
      11:12:44,257 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      11:12:44,257 ERROR [STDERR] at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
      11:12:44,257 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      11:12:44,257 ERROR [STDERR] at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
      11:12:44,257 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      11:12:44,257 ERROR [STDERR] at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:240)
      11:12:44,257 ERROR [STDERR] at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:210)
      11:12:44,257 ERROR [STDERR] at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:84)
      11:12:44,257 ERROR [STDERR] at $Proxy117.query(Unknown Source)
      11:12:44,257 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      11:12:44,257 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      11:12:44,257 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      11:12:44,257 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
      11:12:44,257 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
      11:12:44,257 ERROR [STDERR] at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
      11:12:44,257 ERROR [STDERR] at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:76)
      11:12:44,257 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
      11:12:44,257 ERROR [STDERR] at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:106)
      11:12:44,257 ERROR [STDERR] at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:54)
      11:12:44,257 ERROR [STDERR] at org.javassist.tmp.java.lang.Object_$$_javassist_2.query(Object_$$_javassist_2.java)
      11:12:44,257 ERROR [STDERR] at de.oats.datenvisualisierung.session.mdb.QueryMessageBean.onMessage(QueryMessageBean.java:53)
      11:12:44,257 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      11:12:44,257 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      11:12:44,257 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      11:12:44,257 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
      11:12:44,257 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
      11:12:44,257 ERROR [STDERR] at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
      11:12:44,257 ERROR [STDERR] at org.jboss.seam.intercept.EJBInvocationContext.proceed(EJBInvocationContext.java:44)
      11:12:44,257 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
      11:12:44,257 ERROR [STDERR] at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
      11:12:44,257 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      11:12:44,257 ERROR [STDERR] at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
      11:12:44,267 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      11:12:44,267 ERROR [STDERR] at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
      11:12:44,267 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      11:12:44,267 ERROR [STDERR] at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:116)
      11:12:44,267 ERROR [STDERR] at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:50)
      11:12:44,267 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      11:12:44,267 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      11:12:44,267 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      11:12:44,267 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
      11:12:44,267 ERROR [STDERR] at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
      11:12:44,277 ERROR [STDERR] at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
      11:12:44,277 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      11:12:44,277 ERROR [STDERR] at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
      11:12:44,277 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      11:12:44,277 ERROR [STDERR] at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
      11:12:44,277 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      11:12:44,277 ERROR [STDERR] at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
      11:12:44,277 ERROR [STDERR] at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:195)
      11:12:44,277 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      11:12:44,277 ERROR [STDERR] at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
      11:12:44,277 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      11:12:44,277 ERROR [STDERR] at org.jboss.ejb3.mdb.MessagingContainer.localInvoke(MessagingContainer.java:249)
      11:12:44,277 ERROR [STDERR] at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.delivery(MessageInflowLocalProxy.java:268)
      11:12:44,277 ERROR [STDERR] at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.invoke(MessageInflowLocalProxy.java:138)
      11:12:44,277 ERROR [STDERR] at $Proxy133.onMessage(Unknown Source)
      11:12:44,277 ERROR [STDERR] at org.jboss.resource.adapter.jms.inflow.JmsServerSession.onMessage(JmsServerSession.java:178)
      11:12:44,277 ERROR [STDERR] at org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageConsumer.java:891)
      11:12:44,277 ERROR [STDERR] at org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:170)
      11:12:44,277 ERROR [STDERR] at org.jboss.mq.SpySession.run(SpySession.java:323)
      11:12:44,277 ERROR [STDERR] at org.jboss.resource.adapter.jms.inflow.JmsServerSession.run(JmsServerSession.java:237)
      11:12:44,277 ERROR [STDERR] at org.jboss.resource.work.WorkWrapper.execute(WorkWrapper.java:204)
      11:12:44,277 ERROR [STDERR] at org.jboss.util.threadpool.BasicTaskWrapper.run(BasicTaskWrapper.java:275)
      11:12:44,277 ERROR [STDERR] at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:756)
      11:12:44,277 ERROR [STDERR] at java.lang.Thread.run(Thread.java:619)
      11


      here the class header of the mdb
      @MessageDriven(name="DBQuery", activationConfig = {
       @ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"),
       @ActivationConfigProperty(propertyName="destination", propertyValue="queue/dbMessageQueue"),
       @ActivationConfigProperty(propertyName="maxSession", propertyValue="1")
      
      })
      @Name("dbQuery")
      public class DBQuery implements MessageListener


      I use JBoss-4.2.2.GA and a Seam-Web-Project v2.0.0.GA

        • 1. Re: Longrunning process
          Nicklas Karlsson Master

          Tried a

          @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) ?

          • 2. Re: Longrunning process
            Andreas Franke Apprentice

            Hi,

            thank you. It works now.

            First I putted this on methods with the same exception than on to class definition and that was the solution.


            • 3. Re: Longrunning process
              Gerardo Segura Newbie

              hispeedsurfer:
              do you mind explaining more details please? was a refactorization the solution?

              • 4. Re: Longrunning process
                Andreas Franke Apprentice

                Hi,

                I have a mdb

                @MessageDriven(name="QueryMessageBean", activationConfig = {
                 @ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"),
                 @ActivationConfigProperty(propertyName="destination", propertyValue="queue/oatsMessageQueue"),
                 @ActivationConfigProperty(propertyName="maxSession", propertyValue="1")
                
                })
                @Name("queryMessageBean")
                public class QueryMessageBean implements MessageListener {
                
                 @Resource
                 private MessageDrivenContext context;
                 @In(create=true)
                 private MySqlToORDB mySqlToOrdb;


                and on class header of MySqlToOrdb I have declared these transactionattribute
                @Stateless
                @Name("mySqlToOrdb")
                @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
                public class MySqlToORDbBean implements MySqlToORDB {
                
                 @PersistenceContext
                 private EntityManager entityManager;


                I hope this helps