9 Replies Latest reply on Nov 21, 2008 5:47 AM by kukeltje

    TX Service not configured

    wikiwack

      Hello all -

      I'm a new user of jbpm and am trying to execute the database tutorial in the user's guide --> http://docs.jboss.com/jbpm/v3.2/userguide/html/tutorial.html#databaseexample.

      I've set up my example to use MySql with the following hibernate.cfg.xml settings:

       <!-- hibernate dialect -->
       <property name="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>
      
       <!-- JDBC connection properties (begin) === -->
       <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
       <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/jbpm32</property>
       <property name="hibernate.connection.username">jbossjbpm</property>
       <property name="hibernate.connection.password">jbossjbpm</property>
       <!-- ==== JDBC connection properties (end) -->
      
       <property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
       <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
      


      I've configured my jbpm.cfg.xml file as follows:
       <jbpm-context>
       <service name="persistence" factory="org.jbpm.persistence.db.DbPersistenceServiceFactory">
       <field name="isTransactionEnabled"><false /></field>
       </service>
       </jbpm-context>
      
       <string name="resource.hibernate.cfg.xml" value="jBPM.hibernate.cfg.xml" />
      


      I build the MySQL database using the following script: "http://wiki.jboss.org/wiki/attach?page=JbpmOnTomcat%2Fjbpm.jpdl.mysql.sql"

      When executing the test script I get the following error:
      14:41:40,138 ERROR [Services] problem closing service 'persistence'
      org.jbpm.JbpmException: no jbpm tx service configured
       at org.jbpm.persistence.db.DbPersistenceService.isRollbackOnly(DbPersistenceService.java:388)
       at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:210)
       at org.jbpm.svc.Services.close(Services.java:222)
       at org.jbpm.JbpmContext.close(JbpmContext.java:139)
       at test.example.workflow.HelloWorldDbTest.deployProcessDefinition(HelloWorldDbTest.java:122)
       at test.example.workflow.HelloWorldDbTest.testSimplePersistence(HelloWorldDbTest.java:88)
       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 junit.framework.TestCase.runTest(TestCase.java:154)
       at junit.framework.TestCase.runBare(TestCase.java:127)
       at junit.framework.TestResult$1.protect(TestResult.java:106)
       at junit.framework.TestResult.runProtected(TestResult.java:124)
       at junit.framework.TestResult.run(TestResult.java:109)
       at junit.framework.TestCase.run(TestCase.java:118)
       at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
       at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
      


      I've tried searching for information on the TX service, but haven't found anything. Also, as you can see in the above jbpm.cfg.xml file - I tried turning off transactions by setting isTransactionEnabled to false. I still get the same exception.

      I'm using jbpm 3.2 with the following jvm:

      java version "1.5.0_11"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_11-b03)
      Java HotSpot(TM) Client VM (build 1.5.0_11-b03, mixed mode)

      Any help would be greatly appreciated.

      Thanks,

      - Ryan

        • 1. Re: TX Service not configured
          wikiwack

          Well - I fixed this problem by adding the following service to the jbpm.cfg.xml file:

          <service name="tx" factory="org.jbpm.tx.TxServiceFactory"/>
          


          So, here's my question. All the documentation I saw stated that you just have to add the persistence service to use a database, but (at least in my case) this wasn't true. So, does that documentation need to be updated or did I configure my code wrong?

          Thanks,

          - Ryan

          • 2. Re: TX Service not configured
            kukeltje

            afaik a transactionservice is not needed IF you do not configure transactions in hibernate. If you do a transactionservice is also needed

            • 3. Re: TX Service not configured
              wikiwack

              k - Thanks for the clarification.

              • 4. Re: TX Service not configured
                kukeltje

                hey... in case I say 'afaik', I could/might be wrong.... most of the time i'm not sure then ;-)

                • 5. Re: TX Service not configured
                  wikiwack

                  LOL - thanks for letting me know. :)

                  I removed the following line from the hibernate.cfg.xml file:

                  <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
                  


                  Then I removed the tx service from the jbpm.cfg.xml file. I got the same error as stated above:

                  14:41:40,138 ERROR [Services] problem closing service 'persistence'
                  org.jbpm.JbpmException: no jbpm tx service configured
                  


                  So, I'm still not sure how to get the example working without adding the tx service. But, no big deal now since I can now run the example. Thanks for responding!

                  - Ryan

                  • 6. Re: TX Service not configured
                    anil14349



                    add the line given above in jbpm-context then it will solve the problum

                    • 7. Re: TX Service not configured
                      anil14349



                      add the line given below in jbpm-context then it will solve the problem
                      "< service name="tx" factory="org.jbpm.tx.TxServiceFactory" />"

                      • 8. Re: TX Service not configured
                        the.trav

                        He's already added that line, his questions is why a transaction service is needed when he's not getting jbpm to manage transactions at all.

                        I'd like to know the answer to that question as well

                        • 9. Re: TX Service not configured
                          kukeltje

                          The TxService is a small class that keeps the information whether a current transaction should be rolled back or not (as you can see in the code). It is not a real, full-blown service. The methods in this class were initially in the DbPersistencyService class, but deprecated.

                          What the real use is of such a service I'm not sure. You can configure transactionmanagers in hibernate or your datasource. It has probably something to do with extensibility, but it might just be that no real use for it has come up.