4 Replies Latest reply on Aug 17, 2006 9:38 AM by cpob

    CommandExecuter thread and CMT

    olivier_debels

      Hello,

      I'm currently using Jbpm 3.1.1 with CMT configured (by setting 'isTransactionEnabled' to false in my jbpm.cfg.xml).

      Whenever an exception occurs in the command executer thread, I get the exception: "setRollbackOnly was invoked while configuration specifies user managed transactions".

      The reason for this is that in the commandExecuterThread any error is catched by:

      ...
      } catch (Throwable t) {
       // rollback the transaction
       log.debug("command '"+message+"' threw exception. rolling back transaction", t);
      jbpmContext.setRollbackOnly();
      ...
      


      And when the context is closed afterwards (jbpmContext.close()), all services will be closed. Looking at the DbPersistenceServiceProvider code this results in:

      public void close() {
       if ( (session!=null)
       && (transaction==null)
       && (isRollbackOnly)
       ) {
       throw new JbpmException("setRollbackOnly was invoked while configuration specifies user managed transactions");
       }
      ...
      


      Since we have no transaction (we configured it this way) and the isRollbackOnly is true (set by previous code) we get this exception.

      So I seems like the command executor thread is not behaving well when working in a CMT.


        • 1. Re: CommandExecuter thread and CMT
          olivier_debels


          Is it worth making a JIRA issue of this?

          Or am I missing something?

          • 2. Re: CommandExecuter thread and CMT
            cpob

            Can you show me your xml how you disabled transactions in jBPM?

            I found an error in the documentation, so your transactions might not actually be disabled.

            • 3. Re: CommandExecuter thread and CMT
              olivier_debels

              Yes,

              indeed there is an error in the documentation stating you have to define but it should be .

              Anyway I did it correctly in my configuration file, but thx for pointing it out, it sure doesn't harm to publish this here.

              <jbpm-context>
               <service name="persistence">
               <factory>
               <bean class="org.jbpm.persistence.db.DbPersistenceServiceFactory">
               <field name="isTransactionEnabled"><false /></field>
               </bean>
               </factory>
               </service>
               ...
              </jbpm-context>


              My problem is actually a bug as far as I can tell. Anyway if you're not using jbpm transactions and using commandExecutorThread you should have the same issue (no?).

              It just wanted to point this out and see if I am correct, even if it does not affect me at this moment (we are not using commandExecutorThread yet...)

              Olivier.

              • 4. Re: CommandExecuter thread and CMT
                cpob

                Ah, I failed to notice you were using the command executor thread.

                Yeah, looking at the code, it sure looks like a bug.