1 Reply Latest reply on May 26, 2006 3:20 PM by Gavin King

    TransactionRollback when starting a pageflow

    Tan Quach Newbie

      I wrote a simple pageflow using jPDL. It has a two pages: one start-page node that transitions to another page node.

      The bean class looks like:

      @Stateful
      @Name("viewReports")
      @Conversational(ifNotBegunOutcome="home")
      @Interceptors(SeamInterceptor.class)
      @Scope(ScopeType.CONVERSATION)
      public class ViewReportsAction implements ViewReports {
       @PersistenceContext(type = PersistenceContextType.EXTENDED)
       EntityManager entityManager;
      
       @Create @Begin(join=true,pageflow="viewReports-pageflow")
       public void begin() {
       }
      
       public void viewReport() { ... }
      
       @End
       public void end() {
       }
      
       @Remove @Destroy
       public void destroy() {
       logger.info( "Destroy method called." );
       }
      }
      


      In addition, my "viewReports" bean has an EntityManager using @PersistenceContext(type=EXTENDED).

      When I test this out, the "begin()" method is called, but then it results in this stacktrace (abbreviated):

      SEVERE: Error Rendering View[/viewReports.xhtml]
      java.lang.RuntimeException: javax.transaction.RollbackException: Already marked for rollback TransactionImpl:XidImpl[FormatId=257, GlobalId=Mac-OS-X.local/17, BranchQual=, localId=17]
       at org.jboss.ejb3.stateful.StatefulBeanContext.remove(StatefulBeanContext.java:270)
       at org.jboss.ejb3.AbstractPool.remove(AbstractPool.java:171)
       at org.jboss.ejb3.cache.simple.SimpleStatefulCache.remove(SimpleStatefulCache.java:284)
       at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:89)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:199)
       at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98)
       at $Proxy161.begin(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: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.callCreateMethod(Component.java:1170)
       at org.jboss.seam.Component.newInstance(Component.java:1159)
       at org.jboss.seam.Component.getInstance(Component.java:1107)
       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)
      
      


      More interesting was this:
      2006-05-26 10:21:22,523 DEBUG [org.jboss.seam.jsf.SeamVariableResolver] resolved name to managed bean
      2006-05-26 10:21:22,523 DEBUG [org.jboss.seam.jsf.SeamVariableResolver] resolving name: viewReports
      2006-05-26 10:21:22,524 DEBUG [org.jboss.seam.Component] instantiating Seam component: viewReports
      2006-05-26 10:21:23,219 DEBUG [org.hibernate.impl.SessionImpl] opened session at timestamp: 4704928084615168
      2006-05-26 10:21:23,219 DEBUG [org.hibernate.jdbc.JDBCContext] TransactionFactory reported no active transaction; Synchronization not registered
      2006-05-26 10:21:23,219 DEBUG [org.hibernate.ejb.AbstractEntityManagerImpl] Looking for a JTA transaction to join
      2006-05-26 10:21:23,274 DEBUG [org.jboss.seam.interceptors.RemoveInterceptor] Stateful component was removed: viewReports
      2006-05-26 10:21:23,278 ERROR [STDERR] java.lang.RuntimeException: javax.transaction.RollbackException: Already marked for rollback TransactionImpl:XidImpl[FormatId=257, GlobalId=Classics-Mac-OS-X.local/17, BranchQual=, localId=17]
      2006-05-26 10:21:23,279 ERROR [STDERR] at org.jboss.ejb3.stateful.StatefulBeanContext.remove(StatefulBeanContext.java:270)
      


      It seems that the component was removed immediately after it was created.

      Further down the stacktrace, it complains about
      2006-05-26 10:21:23,316 ERROR [STDERR] org.hibernate.TransactionException: could not register synchronization with JTA TransactionManager
      


      Here are some of the other configuration settings:

       <context-param>
       <param-name>org.jboss.seam.core.jbpm.pageflowDefinitions</param-name>
       <param-value>reports-nav.jpdl.xml</param-value>
       </context-param>
      


      I've been debugging this problem for the last day. It doesn't seem to be too complicated a scenario, since there is only two states/pages.

      Does anyone have any insight on why this is happening?

      I am using JBoss Seam 1.0.0 CR2 with JBoss 4.0.4.CR2. I believe it is Hibernate 3.1.1?