1 2 Previous Next 20 Replies Latest reply on Feb 5, 2007 4:13 PM by Juan Giovanolli

    Transaction problem after upgrade

    Thorsten Kunz Novice

      I just upgraded to the latest seam CVS and JBoss AS 4.0.4.CR2 / EJB3 RC6. I changed all the things required to make it work, including new config files, etc.
      Now the application is working fine again but I am getting an exception when working with PooledTaskInstanceList and TaskInstanceList:

      java.lang.IllegalStateException: No active transaction
       at org.jboss.seam.util.Transactions.registerSynchronization(Transactions.java:77)
       at org.jboss.seam.core.ManagedJbpmContext.getJbpmContext(ManagedJbpmContext.java:71)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)
       at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
       at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:32)
       at org.jboss.seam.Component.callComponentMethod(Component.java:1163)
       at org.jboss.seam.Component.unwrap(Component.java:1179)
       at org.jboss.seam.Component.getInstance(Component.java:1101)
       at org.jboss.seam.Component.getInstance(Component.java:1078)
       at org.jboss.seam.Component.getInstance(Component.java:1065)
       at org.jboss.seam.core.ManagedJbpmContext.instance(ManagedJbpmContext.java:108)
       at org.jboss.seam.core.PooledTaskInstanceList.getPooledTaskInstanceList(PooledTaskInstanceList.java:34)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)
       at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
       at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:32)
       at org.jboss.seam.Component.callComponentMethod(Component.java:1163)
       at org.jboss.seam.Component.unwrap(Component.java:1179)
       at org.jboss.seam.Component.getInstance(Component.java:1101)
       at org.jboss.seam.Component.getInstance(Component.java:1071)
       at org.jboss.seam.jsf.SeamVariableResolver.resolveVariable(SeamVariableResolver.java:44)
       at com.sun.facelets.el.LegacyELContext$LegacyELResolver.getValue(LegacyELContext.java:134)
       at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:41)
       at com.sun.el.parser.AstEmpty.getValue(AstEmpty.java:28)
       at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:183)
       at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
       at com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.java:56)
       at javax.faces.component.UIComponentBase.isRendered(UIComponentBase.java:1151)
       at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:231)
       at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:239)
       at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:239)
       at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:521)
       at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:372)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:109)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:23)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:45)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
       at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:54)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:174)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
       at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
       at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
       at java.lang.Thread.run(Unknown Source)
      

      It worked well before the upgrade and I changed nothing else but the upgrade stuff so maybe I missed something? This is my jbpm.cfg.xml
      <jbpm-configuration>
      
       <jbpm-context>
       <service name="persistence">
       <factory>
       <bean class="org.jbpm.persistence.db.DbPersistenceServiceFactory">
       <field name="isTransactionEnabled"><false/></field>
       </bean>
       </factory>
       </service>
       <service name="message" factory="org.jbpm.msg.db.DbMessageServiceFactory" />
       <service name="scheduler" factory="org.jbpm.scheduler.db.DbSchedulerServiceFactory" />
       <service name="logging" factory="org.jbpm.logging.db.DbLoggingServiceFactory" />
       <service name="authentication" factory="org.jbpm.security.authentication.DefaultAuthenticationServiceFactory" />
       </jbpm-context>
      
      </jbpm-configuration>
      

      Any ideas?

        • 1. Re: Transaction problem after upgrade
          Gavin King Master

          This is occuring because you have no transaction active when you try to use the jBPM context. Possible solutions:

          (1) You could use SeamExtendedManagedPersistencePhaseListener
          (2) I could change Seam to support non-transactional access to the task lists
          (3) I could change Seam to use a txn just especially for retrieving the task lists

          I recommend you do (1).

          I'll give (2) some thought. Not sure how much I like it, or what the full implications are.

          I should at least do (3).

          • 2. Re: Transaction problem after upgrade
            Gavin King Master

            I implemented (3) in CVS.

            • 3. Re: Transaction problem after upgrade
              Thorsten Kunz Novice

              hm, now I am getting this Exception:

              java.lang.IllegalStateException: JbpmContext may only be used inside a transaction
               at org.jboss.seam.core.ManagedJbpmContext.getJbpmContext(ManagedJbpmContext.java:71)
               at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
               at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
               at java.lang.reflect.Method.invoke(Unknown Source)
               at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
               at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:32)
               at org.jboss.seam.Component.callComponentMethod(Component.java:1182)
               at org.jboss.seam.Component.unwrap(Component.java:1198)
               at org.jboss.seam.Component.getInstance(Component.java:1120)
               at org.jboss.seam.Component.getInstance(Component.java:1097)
               at org.jboss.seam.Component.getInstance(Component.java:1084)
               at org.jboss.seam.core.ManagedJbpmContext.instance(ManagedJbpmContext.java:112)
               at org.jboss.seam.core.PooledTaskInstanceList.getPooledTaskInstanceList(PooledTaskInstanceList.java:33)
               at org.jboss.seam.core.PooledTaskInstanceList$$EnhancerByCGLIB$$6b764eda.CGLIB$getPooledTaskInstanceList$0(<generated>)
               at org.jboss.seam.core.PooledTaskInstanceList$$EnhancerByCGLIB$$6b764eda$$FastClassByCGLIB$$8400b76c.invoke(<generated>)
               at net.sf.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:167)
               at org.jboss.seam.interceptors.JavaBeanInterceptor$1.proceed(JavaBeanInterceptor.java:80)
               at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
               at org.jboss.seam.interceptors.ValidationInterceptor.validateTargetComponent(ValidationInterceptor.java:64)
               at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
               at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
               at java.lang.reflect.Method.invoke(Unknown Source)
               at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
               at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
               at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
               at org.jboss.seam.interceptors.OutcomeInterceptor.interceptOutcome(OutcomeInterceptor.java:21)
               at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
               at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
               at java.lang.reflect.Method.invoke(Unknown Source)
               at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
               at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
               at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
               at org.jboss.seam.interceptors.RollbackInterceptor.rollbackIfNecessary(RollbackInterceptor.java:30)
               at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
               at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
               at java.lang.reflect.Method.invoke(Unknown Source)
               at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
               at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
               at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
               at org.jboss.seam.interceptors.TransactionInterceptor.doInTransactionIfNecessary(TransactionInterceptor.java:35)
               at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
               at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
               at java.lang.reflect.Method.invoke(Unknown Source)
               at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
               at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
               at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
               at org.jboss.seam.interceptors.BijectionInterceptor.bijectTargetComponent(BijectionInterceptor.java:33)
               at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
               at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
               at java.lang.reflect.Method.invoke(Unknown Source)
               at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
               at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
               at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
               at org.jboss.seam.interceptors.ConversationInterceptor.endOrBeginLongRunningConversation(ConversationInterceptor.java:68)
               at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
               at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
               at java.lang.reflect.Method.invoke(Unknown Source)
               at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
               at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
               at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
               at org.jboss.seam.interceptors.BusinessProcessInterceptor.manageBusinessProcessContext(BusinessProcessInterceptor.java:60)
               at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
               at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
               at java.lang.reflect.Method.invoke(Unknown Source)
               at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
               at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
               at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
               at org.jboss.seam.interceptors.RemoveInterceptor.removeIfNecessary(RemoveInterceptor.java:39)
               at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
               at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
               at java.lang.reflect.Method.invoke(Unknown Source)
               at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
               at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
               at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
               at org.jboss.seam.ejb.SeamInterceptor.aroundInvokeInContexts(SeamInterceptor.java:73)
               at org.jboss.seam.ejb.SeamInterceptor.aroundInvoke(SeamInterceptor.java:45)
               at org.jboss.seam.interceptors.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:51)
               at org.jboss.seam.interceptors.JavaBeanInterceptor.intercept(JavaBeanInterceptor.java:39)
               at org.jboss.seam.core.PooledTaskInstanceList$$EnhancerByCGLIB$$6b764eda.getPooledTaskInstanceList(<generated>)
               at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
               at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
               at java.lang.reflect.Method.invoke(Unknown Source)
               at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
               at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:32)
               at org.jboss.seam.Component.callComponentMethod(Component.java:1182)
               at org.jboss.seam.Component.unwrap(Component.java:1198)
               at org.jboss.seam.Component.getInstance(Component.java:1120)
               at org.jboss.seam.Component.getInstance(Component.java:1090)
               at org.jboss.seam.jsf.SeamVariableResolver.resolveVariable(SeamVariableResolver.java:44)
               at com.sun.facelets.el.LegacyELContext$LegacyELResolver.getValue(LegacyELContext.java:134)
               at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:41)
               at com.sun.el.parser.AstEmpty.getValue(AstEmpty.java:28)
               at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:183)
               at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
               at com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.java:56)
               at javax.faces.component.UIComponentBase.isRendered(UIComponentBase.java:1151)
               at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:231)
               at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:239)
               at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:239)
               at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:521)
               at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:372)
               at javax.faces.webapp.FacesServlet.service(FacesServlet.java:109)
               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
               at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:23)
               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
               at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:45)
               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
               at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
               at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
               at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
               at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:54)
               at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:174)
               at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
               at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
               at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
               at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
               at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
               at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
               at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
               at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
               at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
               at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
               at java.lang.Thread.run(Unknown Source)

              Do I have to change anything else in order to make it work with your patch? I am still useing the regular SeamPhaseListener, do I have to change that?

              • 4. Re: Transaction problem after upgrade
                Gavin King Master

                That is very hard to understand. I added @Transactional to PooledTaskInstanceList.getPooledTaskInstanceList(). It should begin a transaction...

                • 5. Re: Transaction problem after upgrade
                  Gavin King Master

                  Ooops! Me stupid. Get another update from CVS.

                  • 6. Re: Transaction problem after upgrade
                    Thorsten Kunz Novice

                    yay, that did it! Thanks

                    • 7. Re: Transaction problem after upgrade
                      Thorsten Kunz Novice

                      hehe, I am one step further now but I ran into the next problem right away :)
                      The TaskLists do work fine now but when a method annotated with @CreateProcess is executed I am getting this Exception again:

                      Caused by: java.lang.IllegalStateException: JbpmContext may only be used inside a transaction
                       at org.jboss.seam.core.ManagedJbpmContext.getJbpmContext(ManagedJbpmContext.java:71)
                       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                       at java.lang.reflect.Method.invoke(Unknown Source)
                       at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
                       at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:32)
                       at org.jboss.seam.Component.callComponentMethod(Component.java:1182)
                       at org.jboss.seam.Component.unwrap(Component.java:1198)
                       at org.jboss.seam.Component.getInstance(Component.java:1120)
                       at org.jboss.seam.Component.getInstance(Component.java:1097)
                       at org.jboss.seam.Component.getInstance(Component.java:1084)
                       at org.jboss.seam.core.ManagedJbpmContext.instance(ManagedJbpmContext.java:112)
                       at org.jboss.seam.interceptors.BusinessProcessInterceptor.createProcess(BusinessProcessInterceptor.java:125)
                       at org.jboss.seam.interceptors.BusinessProcessInterceptor.afterInvocation(BusinessProcessInterceptor.java:107)
                       at org.jboss.seam.interceptors.BusinessProcessInterceptor.manageBusinessProcessContext(BusinessProcessInterceptor.java:60)
                       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                       at java.lang.reflect.Method.invoke(Unknown Source)
                       at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
                       at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
                       at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
                       at org.jboss.seam.interceptors.RemoveInterceptor.removeIfNecessary(RemoveInterceptor.java:39)
                       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                       at java.lang.reflect.Method.invoke(Unknown Source)
                       at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
                       at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
                       at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
                       at org.jboss.seam.ejb.SeamInterceptor.aroundInvokeInContexts(SeamInterceptor.java:73)
                       at org.jboss.seam.ejb.SeamInterceptor.aroundInvoke(SeamInterceptor.java:45)
                       at org.jboss.seam.interceptors.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:51)
                       at org.jboss.seam.interceptors.JavaBeanInterceptor.intercept(JavaBeanInterceptor.java:39)
                       at com.broadcore.broadview.TaskList$$EnhancerByCGLIB$$f7beb325.createTodo(<generated>)
                       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                       at java.lang.reflect.Method.invoke(Unknown Source)
                       at com.sun.el.parser.AstValue.invoke(AstValue.java:130)
                       at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:274)
                       at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
                       at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:69)

                      Now I have already tried to annotate the very same method with @Transactional as well as the whole class but the same Exception is thrown no matter what.

                      • 8. Re: Transaction problem after upgrade
                        Gavin King Master

                        So, you need a transaction for that method.

                        Is it an EJB? If so, a txn should be used by default.

                        A JavaBean? Add @Transactional.


                        Why on earth have you got so much code that does not run in a transaction!!?

                        • 9. Re: Transaction problem after upgrade
                          Thorsten Kunz Novice

                          I don't think it is much code, all the errors occure in very little code acually

                          package com.broadcore.broadview;
                          
                          import java.io.IOException;
                          import java.io.InputStream;
                          import java.util.Properties;
                          
                          import org.jboss.logging.Logger;
                          import org.jboss.seam.annotations.BeginTask;
                          import org.jboss.seam.annotations.CreateProcess;
                          import org.jboss.seam.annotations.End;
                          import org.jboss.seam.annotations.EndTask;
                          import org.jboss.seam.annotations.In;
                          import org.jboss.seam.annotations.Name;
                          import org.jboss.seam.annotations.StartTask;
                          import org.jboss.seam.annotations.Transactional;
                          import org.jboss.seam.util.Resources;
                          import org.jbpm.taskmgmt.exe.TaskInstance;
                          
                          @Name("TaskList")
                          @Transactional
                          public class TaskList {
                          
                           private static final Logger log = Logger.getLogger(TaskList.class);
                          
                           private static final String TASKMAPPING_PROP_FILE = "/taskmapping.properties";
                          
                           private static final Properties properties = new Properties();
                          
                           static {
                           try {
                           InputStream stream = Resources.getResourceAsStream(TASKMAPPING_PROP_FILE);
                           properties.load(stream);
                           } catch(IOException e) {
                           log.error("unable to load properties from file: " + e.getMessage());
                           e.printStackTrace();
                           }
                           }
                          
                           @In(required=false,create=false)
                           private TaskInstance taskInstance;
                          
                           @CreateProcess(definition = "BroadCoreOrder")
                           public void createTodo() {
                           }
                          
                           @StartTask
                           public String startTask() {
                           return getTaskMapping(taskInstance.getName());
                           }
                          
                           @BeginTask
                           public String resumeTask() {
                           return getTaskMapping(taskInstance.getName());
                           }
                          
                           @EndTask
                           public String endTask() {
                           return "taskList";
                           }
                          
                           @End
                           public String holdTask() {
                           return "taskList";
                           }
                          
                           private String getTaskMapping(String taskName) {
                           String view = properties.getProperty(taskName);
                          
                           if(view == null)
                           return "taskList";
                          
                           return view;
                          
                           }
                          }
                          

                          It is not even much more than in the tasklist example because this is what it is supposed to be - a very simple tasklist. And as you can see I have already annotated the JavaBean with @Transactional but the Exception still persists (I also tried to annotate the createTodo method with @Transactional with the same result).

                          • 10. Re: Transaction problem after upgrade
                            Eric Jutrzenka Newbie

                            Did you find a solution to this?

                            I'm having a similar problem but I'm only getting the exception on the methods annotated @EndTask:


                            @Name("depositPermission")
                            @Scope(ScopeType.CONVERSATION)
                            @Transactional
                            public class DepositPermissionAction {
                            
                             private String note;
                            
                             @In(required=false)
                             private String userName;
                            
                             @In(required=false)
                             private String userID;
                            
                             @In(required=false)
                             private String containerName;
                            
                             @In(required=false)
                             private boolean inherited;
                            
                             @In(required=false)
                             private Long containerId;
                            
                             @In(create=true)
                             private UserBean userBean;
                            
                             @In(create=true)
                             private ContainerBean containerBean;
                            
                             @In(create=true)
                             private ContainerDelegate containerDelegate;
                            
                             @In(create=true)
                             private EmailMessageBean emailMessageBean;
                            
                            
                            
                            
                             @BeginTask @Begin
                             public String view() {
                             return "view_deposit_request";
                             }
                            
                             @EndTask @End
                             @Transactional
                             public String approve() throws ConfigurationException {
                             userBean.load(userID);
                             containerBean.load(containerId);
                             userBean.getObject().getDepositContainers().add(containerBean.getObject());
                             containerDelegate.setContainerBean(containerBean);
                             userBean.getObject().getDepositContainers().addAll(containerDelegate.getAllSubContainers());
                            
                             userBean.update();
                            
                            
                             return "";
                             }
                            
                             @EndTask @End
                             @Transactional
                             public String reject() {
                            
                             userBean.load(userID);
                             containerBean.load(containerId);
                            
                            
                            
                             return "";
                             }
                            
                             @End
                             public String cancel() {
                             return "/task_management.xhtml";
                             }
                            
                            
                            
                            }
                            


                            • 11. Re: Transaction problem after upgrade
                              Gavin King Master


                              A "similar" problem? What is the stacktrace?

                              Note that you don't use @End and @EndTask together. One or the other. Same with @Begin and @BeginTask.

                              • 12. Re: Transaction problem after upgrade
                                Eric Jutrzenka Newbie

                                Thanks, I removed the @Begin and @End annotations but no joy.

                                The stack trace is much the same. The exception is thrown when calling org.jboss.seam.core.ManagedJbpmContext.getJbpmContext().

                                I inserted breakpoints in org.jboss.seam.interceptors.TransactionInterceptor but found that the exception is being thrown after the interceptor has finished doing it's work. I modified Seam and annotated ManagedJbpmContext.getJbpmContext() with @Transactional to see what would happen and found that the behaviour was the same.

                                Admitedly, I'm at the limits of my (v. limited) understanding here. As far as I can tell the task is being ended; I'm just getting this annoying exception.

                                Here is the full stack trace:

                                java.lang.IllegalStateException: JbpmContext may only be used inside a transaction
                                 at org.jboss.seam.core.ManagedJbpmContext.getJbpmContext(ManagedJbpmContext.java:71)
                                 at sun.reflect.GeneratedMethodAccessor170.invoke(Unknown Source)
                                 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:17)
                                 at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:82)
                                 at org.jboss.seam.Component.callComponentMethod(Component.java:1612)
                                 at org.jboss.seam.Component.unwrap(Component.java:1633)
                                 at org.jboss.seam.Component.getInstance(Component.java:1465)
                                 at org.jboss.seam.Component.getInstance(Component.java:1433)
                                 at org.jboss.seam.Component.getInstance(Component.java:1415)
                                 at org.jboss.seam.core.ManagedJbpmContext.instance(ManagedJbpmContext.java:112)
                                 at org.jboss.seam.core.ProcessInstance.getProcessInstance(ProcessInstance.java:42)
                                 at org.jboss.seam.core.ProcessInstance$$EnhancerByCGLIB$$fdc4d28.CGLIB$getProcessInstance$0(<generated>)
                                 at org.jboss.seam.core.ProcessInstance$$EnhancerByCGLIB$$fdc4d28$$FastClassByCGLIB$$8ec14899.invoke(<generated>)
                                 at net.sf.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:167)
                                 at org.jboss.seam.interceptors.JavaBeanInterceptor$3.proceed(JavaBeanInterceptor.java:187)
                                 at org.jboss.seam.ejb.SeamInterceptor.invokeInContexts(SeamInterceptor.java:220)
                                 at org.jboss.seam.ejb.SeamInterceptor.invoke(SeamInterceptor.java:186)
                                 at org.jboss.seam.ejb.SeamInterceptor.aroundInvoke(SeamInterceptor.java:173)
                                 at org.jboss.seam.interceptors.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:158)
                                 at org.jboss.seam.interceptors.JavaBeanInterceptor.intercept(JavaBeanInterceptor.java:62)
                                 at org.jboss.seam.core.ProcessInstance$$EnhancerByCGLIB$$fdc4d28.getProcessInstance(<generated>)
                                 at sun.reflect.GeneratedMethodAccessor171.invoke(Unknown Source)
                                 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:17)
                                 at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:82)
                                 at org.jboss.seam.Component.callComponentMethod(Component.java:1612)
                                 at org.jboss.seam.Component.unwrap(Component.java:1633)
                                 at org.jboss.seam.Component.getInstance(Component.java:1465)
                                 at org.jboss.seam.Component.getInstance(Component.java:1433)
                                 at org.jboss.seam.Component.getInstance(Component.java:1415)
                                 at org.jboss.seam.core.ProcessInstance.instance(ProcessInstance.java:58)
                                 at org.jboss.seam.contexts.BusinessProcessContext.getProcessInstance(BusinessProcessContext.java:210)
                                 at org.jboss.seam.contexts.BusinessProcessContext.getContextInstance(BusinessProcessContext.java:197)
                                 at org.jboss.seam.contexts.BusinessProcessContext.getNamesFromContext(BusinessProcessContext.java:103)
                                 at org.jboss.seam.contexts.BusinessProcessContext.getNames(BusinessProcessContext.java:92)
                                 at org.jboss.seam.contexts.Contexts.destroy(Contexts.java:181)
                                 at org.jboss.seam.contexts.Lifecycle.flushAndDestroyContexts(Lifecycle.java:362)
                                 at org.jboss.seam.contexts.Lifecycle.endRequest(Lifecycle.java:272)
                                 at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:108)
                                 at org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersAfter(PhaseListenerManager.java:89)
                                 at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:391)
                                 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:34)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:45)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
                                 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
                                 at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
                                 at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
                                 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
                                 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
                                 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
                                 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
                                 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
                                 at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
                                 at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                                 at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
                                 at java.lang.Thread.run(Thread.java:595)
                                


                                • 13. Re: Transaction problem after upgrade
                                  Gavin King Master

                                  Sticking @Transactional on ManagedJbpmContext is not going to help you, because it is declared @Intercept(NEVER) ;-)


                                  Is this in the CVS version of Seam, or Seam 1.0.1?

                                  • 14. Re: Transaction problem after upgrade
                                    Gavin King Master

                                    OK, you said Seam CVS. So I think I found my breaking change. I'll add an issue to JIRA.

                                    1 2 Previous Next