3 Replies Latest reply on Jul 27, 2009 7:27 AM by lucio piccoli

    JTA transaction error inside jboss portal

    lucio piccoli Newbie

      portal 2.7.2
      jbpm 3.2.2


      hi all

      when accessing the JBPM context inside a portlet of jboss portal the following JTA error occurs depending whether the the context is created or get Current is called.

      i read the details of jbpm transation here
      http://docs.jboss.org/jbpm/v3/userguide/deployment.html

      I thought i understood the JBPM JTA settings but i have totally lost now.


      my JTA settings are below.

      <jbpm-context>
       <service name="persistence" factory="org.jbpm.persistence.jta.JtaDbPersistenceServiceFactory" />
       <service name="scheduler" factory="org.jbpm.scheduler.db.DbSchedulerServiceFactory" />
       <service name="message" factory="org.jbpm.msg.db.DbMessageServiceFactory" />
       <service name="tx" factory="org.jbpm.tx.TxServiceFactory"/>
       </jbpm-context>
      


      When calling getCurrentJbpmContext() as in below, a 'Session closed' error occurs.

      WorkflowService workflowService = (WorkflowService) ctx.lookup("java:/portal/WorkflowService")
      writer.println( "workflowService:" + workflowService );
      
      JbpmContext context = workflowService.getJbpmConfiguration().getCurrentJbpmContext();
      
      List<ProcessDefinition> taskList = context.getGraphSession().findAllProcessDefinitions();
      


      So an existing context is found but the hibernate session is closed.

      2009-07-27 16:21:52,222 ERROR [STDERR] org.hibernate.SessionException: Session is closed!
       at org.hibernate.impl.AbstractSessionImpl.errorIfClosed(AbstractSessionImpl.java:49)
       at org.hibernate.impl.SessionImpl.getNamedQuery(SessionImpl.java:1258)
       at org.jbpm.db.GraphSession.findAllProcessDefinitions(GraphSession.java:209)
       at org.jboss.portal.portlet.samples.SimplestHelloWorldPortlet.doView(SimplestHelloWorldPortlet.java:76)
      


      So when i call createJbpmContext(), the JTA complains that an existing transaction is already on the current thread.

      WorkflowService workflowService = (WorkflowService) ctx.lookup("java:/portal/WorkflowService")
      writer.println( "workflowService:" + workflowService );
      
      JbpmContext context = workflowService.getJbpmConfiguration().createJbpmContext();
      
      List<ProcessDefinition> taskList = context.getGraphSession().findAllProcessDefinitions();
      




      Cause: org.jboss.portal.portlet.PortletInvokerException: java.lang.IllegalStateException: BaseTransaction.checkTransactionState - [com.arjuna.ats.internal.jta.transaction.arjunacore.alreadyassociated] [com.arjuna.ats.internal.jta.transaction.arjunacore.alreadyassociated] thread is already associated with a transaction!
      Message: java.lang.IllegalStateException: BaseTransaction.checkTransactionState - [com.arjuna.ats.internal.jta.transaction.arjunacore.alreadyassociated] [com.arjuna.ats.internal.jta.transaction.arjunacore.alreadyassociated] thread is already associated with a transaction!
      StackTrace:
      
      org.jboss.portal.portlet.PortletInvokerException: java.lang.IllegalStateException: BaseTransaction.checkTransactionState - [com.arjuna.ats.internal.jta.transaction.arjunacore.alreadyassociated] [com.arjuna.ats.internal.jta.transaction.arjunacore.alreadyassociated] thread is already associated with a transaction!
       at org.jboss.portal.portlet.aspects.portlet.ContextDispatcherInterceptor.invoke(ContextDispatcherInterceptor.java:101)
       at org.jboss.portal.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:82)
       at org.jboss.portal.portlet.aspects.portlet.SecureTransportInterceptor.invoke(SecureTransportInterceptor.java:69)
       at org.jboss.portal.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:82)
       at org.jboss.portal.portlet.aspects.portlet.ValveInterceptor.invoke(ValveInterceptor.java:75)
       at org.jboss.portal.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:82)
       at org.jboss.portal.portlet.container.ContainerPortletInvoker.invoke(ContainerPortletInvoker.java:116)
      
      



      how is jbpm configured to use the existing JTA inside portal?

      any help is most appreciated.

      -lp

        • 1. Re: JTA transaction error inside jboss portal
          Ronald van Kuijk Master

          first please try 3.2.6SP1. API wise nothing changed but may issues fixed. It should be a drop-in replacement.

          In addition, check the

          <field name="isTransactionEnabled"><false /></field>
          
          parameter in the jBPM config.

          • 2. Re: JTA transaction error inside jboss portal
            lucio piccoli Newbie

            thanks for the rapid response.

            i have tried replacing the 3.2.2 jpbm jar with 3.2.6 but i cant get portal to work. i have posted the issue on the portal forum but no response yet.

            see http://www.jboss.org/index.html?module=bb&op=viewtopic&t=158977

            have u upgraded the portal jbpm installation?


            -lp

            • 3. Re: JTA transaction error inside jboss portal
              lucio piccoli Newbie

              i have tried he following with true then false and there is no difference.

              
               <service name="persistence">
               <factory>
               <bean class="org.jbpm.persistence.jta.JtaDbPersistenceServiceFactory">
               <field name="isTransactionEnabled"><false /></field>
               </bean>
               </factory>
               </service>
              
              


              Both are producing the same transaction error.

              Cause: org.jboss.portal.portlet.PortletInvokerException: java.lang.IllegalStateException: BaseTransaction.checkTransactionState - [com.arjuna.ats.internal.jta.transaction.arjunacore.alreadyassociated] [com.arjuna.ats.internal.jta.transaction.arjunacore.alreadyassociated] thread is already associated with a transaction!
              Message: java.lang.IllegalStateException: BaseTransaction.checkTransactionState - [com.arjuna.ats.internal.jta.transaction.arjunacore.alreadyassociated] [com.arjuna.ats.internal.jta.transaction.arjunacore.alreadyassociated] thread is already associated with a transaction!
              StackTrace:
              


              any ideas with what i have stuffed up would be most appreciated.

              -lp