8 Replies Latest reply on Feb 27, 2009 8:32 AM by Stefano Ferrante

    Transaction Issue

    Stefano Ferrante Newbie

      Hi all i'm new on JBPM.

      I'm using JBPM 3.3.1 with JBoss 4.2.2GA and Oracle 10 Express.

      I edited the hibernate.cfg.xml to point at Oracle , and seem all ok.
      I created the standard user and group and membership to access the console but when i'm logged, the pages show several errors:


      Error loading task list: An exception of type "org.jbpm.JbpmException" was thrown. The message is: couldn't get task instances list for actor 'manager'



      Error loading process list: An exception of type "org.jbpm.JbpmException" was thrown. The message is: couldn't find all process definitions


      Error loading task list: An exception of type "org.jbpm.JbpmException" was thrown. The message is: couldn't get task instances list for actor 'manager'


      those messages are showed on pages in the console , browsing between
      process list page,or user/groups list page and so on, but on the log the error that i can see is :

      2009-02-11 16:41:46,250 DEBUG [org.jbpm.svc.Services] closing service 'authentication': org.jbpm.security.authentication.DefaultAuthenticationService@1bc865a
      2009-02-11 16:41:49,234 DEBUG [org.jbpm.configuration.JbpmContextInfo] creating jbpm context with service factories '[tx, message, scheduler, logging, persistence, authentication]'
      2009-02-11 16:41:49,234 DEBUG [org.jbpm.JbpmContext] creating org.jbpm.JbpmContext@18a174
      2009-02-11 16:41:49,234 DEBUG [org.jbpm.persistence.jta.JtaDbPersistenceService] begin user transaction
      2009-02-11 16:41:49,234 DEBUG [org.jbpm.persistence.db.DbPersistenceService] using current hibernate session
      2009-02-11 16:41:49,234 ERROR [org.jbpm.db.TaskMgmtSession] org.hibernate.HibernateException: getNamedQuery is not valid without active transaction
      2009-02-11 16:41:49,312 DEBUG [org.jbpm.JbpmContext] closing jbpmContext org.jbpm.JbpmContext@18a174
      2009-02-11 16:41:49,312 DEBUG [org.jbpm.svc.Services] closing service 'persistence': org.jbpm.persistence.jta.JtaDbPersistenceService@1e573e3
      2009-02-11 16:41:49,312 DEBUG [org.jbpm.persistence.jta.JtaDbPersistenceService] rolling back user transaction
      2009-02-11 16:41:49,312 DEBUG [org.jbpm.svc.Services] closing service 'tx': org.jbpm.tx.TxService@11b5298
      2009-02-11 16:41:49,312 DEBUG [org.jbpm.svc.Services] closing service 'authentication': org.jbpm.security.authentication.DefaultAuthenticationService@cbad03




      this is a part of my config file, to create datasource for Hibernate:

      
       <!-- hibernate dialect -->
       <property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
      
      
       <property name="hibernate.current_session_context_class">org.hibernate.context.ThreadLocalSessionContext</property>
      
       <!-- DataSource properties (begin) -->
       <property name="hibernate.connection.datasource">java:JbpmDS</property>
       <!-- DataSource properties (end) -->
      
       <!-- JTA transaction properties (begin) -->
       <property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
       <property name="hibernate.connection.url">jdbc:oracle:thin:@localhost:1521:XE</property>
       <property name="hibernate.connection.username">system</property>
       <property name="hibernate.connection.password">123</property>
       <!-- JTA transaction properties (end) -->
      
       <!-- CMT transaction properties (begin) ===
       <property name="hibernate.transaction.factory_class">org.hibernate.transaction.CMTTransactionFactory</property>
       <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
       ==== CMT transaction properties (end) -->
      
      





      The Data Source named "java:JbpmDS" is defined here:

      <?xml version="1.0" encoding="UTF-8"?>
      <datasources>
      
       <xa-datasource>
       <jndi-name>JbpmDS</jndi-name>
      
       <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
       <xa-datasource-property name="URL">jdbc:oracle:thin:@localhost:1521:XE</xa-datasource-property>
       <user-name>system</user-name>
       <password>123</password>
      
      
      
       <!-- reduce isolation from the default level (repeatable read) -->
       <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
       <!-- separate connections used with and without JTA transaction -->
       <no-tx-separate-pools />
       <!-- disable transaction interleaving -->
       <track-connection-by-tx />
      
       <!-- leverage mysql integration features -->
       <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
       <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker</valid-connection-checker-class-name>
      
       <!-- corresponding type-mapping in conf/standardjbosscmp-jdbc.xml -->
       <metadata>
       <type-mapping>Oracle9i</type-mapping>
       </metadata>
       </xa-datasource>
      
      </datasources>




      i'm not sure if this part is correct, but i don't found anithing about Oracle 10 in the conf files of JBoss about Oracle 10.

      <type-mapping>Oracle9i</type-mapping>



      Anyone can suggest a workaround or something to solve this problem?.


      thanks in advance.







        • 1. Re: Transaction Issue
          Stefano Ferrante Newbie

          The problem is still up, anyone can help me?

          I have another question too, anyone can link me where i can download source code for JBPM 3.3.1?

          Thanks in advance.

          • 2. Re: Transaction Issue
            Mauricio Salatino Master

            are you using XA datasource because you need it or because you copy the datasource from some place?

            • 3. Re: Transaction Issue
              Stefano Ferrante Newbie

              No i don't need it at this moment..
              i want just to run some examples.


              • 4. Re: Transaction Issue
                Stefano Ferrante Newbie

                After your question.. i changed the DS for a not XA datasource, using as template the examples DS under JBoss/docs/examples/jca.

                <?xml version="1.0" encoding="UTF-8"?>
                
                <!-- ===================================================================== -->
                <!-- -->
                <!-- JBoss Server Configuration -->
                <!-- -->
                <!-- ===================================================================== -->
                
                <!-- $Id: oracle-ds.xml 63175 2007-05-21 16:26:06Z rrajesh $ -->
                <!-- ==================================================================== -->
                <!-- Datasource config for Oracle originally from Steven Coy -->
                <!-- ==================================================================== -->
                
                
                <datasources>
                 <local-tx-datasource>
                 <jndi-name>JbpmDS</jndi-name>
                 <connection-url>jdbc:oracle:thin:@localhost:1521:XE</connection-url>
                 <!--
                
                 Here are a couple of the possible OCI configurations.
                 For more information, see http://otn.oracle.com/docs/products/oracle9i/doc_library/release2/java.920/a96654/toc.htm
                
                 <connection-url>jdbc:oracle:oci:@youroracle-tns-name</connection-url>
                 or
                 <connection-url>jdbc:oracle:oci:@(description=(address=(host=youroraclehost)(protocol=tcp)(port=1521))(connect_data=(SERVICE_NAME=yourservicename)))</connection-url>
                
                 Clearly, its better to have TNS set up properly.
                 -->
                 <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
                 <user-name>system</user-name>
                 <password>123</password>
                 <!-- Uses the pingDatabase method to check a connection is still valid before handing it out from the pool -->
                 <!--valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker</valid-connection-checker-class-name-->
                 <!-- Checks the Oracle error codes and messages for fatal errors -->
                 <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
                 <!-- sql to call when connection is created
                 <new-connection-sql>some arbitrary sql</new-connection-sql>
                 -->
                
                 <!-- sql to call on an existing pooled connection when it is obtained from pool - the OracleValidConnectionChecker is prefered
                 <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
                 -->
                
                 <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml -->
                 <metadata>
                 <type-mapping>Oracle9i</type-mapping>
                 </metadata>
                 </local-tx-datasource>
                
                </datasources>
                



                Error log with the same error.


                2009-02-26 10:30:54,178 DEBUG [org.jboss.security.plugins.JaasSecurityManagerService] setCachePolicy, c=org.jboss.util.TimedCachePolicy@10747b4
                2009-02-26 10:30:54,178 DEBUG [org.jboss.security.plugins.JaasSecurityManagerService] Added jbpm-console, org.jboss.security.plugins.SecurityDomainContext@f47af3 to map
                2009-02-26 10:30:54,662 DEBUG [org.jbpm.configuration.JbpmContextInfo] creating jbpm context with service factories '[tx, message, scheduler, logging, persistence, authentication]'
                2009-02-26 10:30:54,662 DEBUG [org.jbpm.JbpmContext] creating org.jbpm.JbpmContext@126d235
                2009-02-26 10:30:54,662 DEBUG [org.jbpm.persistence.jta.JtaDbPersistenceService] begin user transaction
                2009-02-26 10:30:54,662 DEBUG [org.jbpm.persistence.db.DbPersistenceService] using current hibernate session
                2009-02-26 10:30:54,662 DEBUG [org.hibernate.jdbc.JDBCContext] successfully registered Synchronization
                2009-02-26 10:30:54,662 DEBUG [org.hibernate.impl.SessionImpl] opened session at timestamp: 5061184121495552
                2009-02-26 10:30:54,662 ERROR [org.jbpm.db.GraphSession] org.hibernate.HibernateException: getNamedQuery is not valid without active transaction
                2009-02-26 10:30:54,850 DEBUG [org.jbpm.JbpmContext] closing jbpmContext org.jbpm.JbpmContext@126d235
                2009-02-26 10:30:54,850 DEBUG [org.jbpm.svc.Services] closing service 'persistence': org.jbpm.persistence.jta.JtaDbPersistenceService@17c76f6
                2009-02-26 10:30:54,850 DEBUG [org.jbpm.persistence.jta.JtaDbPersistenceService] rolling back user transaction
                2009-02-26 10:30:54,850 DEBUG [org.jbpm.svc.Services] closing service 'tx': org.jbpm.tx.TxService@663731
                2009-02-26 10:30:54,850 DEBUG [org.jbpm.svc.Services] closing service 'authentication': org.jbpm.security.authentication.DefaultAuthenticationService@b19f4e



                And i don't understand this message:

                2009-02-26 10:30:54,850 DEBUG [org.jbpm.persistence.jta.JtaDbPersistenceService] rolling back user transaction

                If jbpm invoke a roll back on a transaction.. well there is a transaction, that instead is missing when calling named query..
                And before the ERROR, seems that session was created successfully..

                Where is the damn error.. i'm sure that is something missing in mine configuration...

                • 5. Re: Transaction Issue
                  Brad Davis Novice

                  You are using a container mangaged transaction in your hibernate configuration. This is why its expecting one to be open when you perform jbpm. Change:

                  hibernate.transaction.factory_class = org.hibernate.transaction.CMTTransactionFactory

                  See: http://www.hibernate.org/42.html

                  • 6. Re: Transaction Issue
                    Stefano Ferrante Newbie

                    Hi brads thanks for reply.

                    I changed that properties too and many others to try something.
                    this is the FULL Hiberante configuration ATM (plus all mapping resource hbm.xml that Jbpm need):

                    <property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
                     <property name="hibernate.current_session_context_class">org.hibernate.context.ThreadLocalSessionContext</property>
                     <property name="hibernate.connection.datasource">java:/JbpmDS</property>
                     <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
                     <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
                    


                    As you can see i'm using now just the DataSource specified as tx-local (see the post above), and getting the same error with only the DataSource not jdbc properties spefied in the Hibernate.cfg.

                    I can still loggging in the console, but as usual can't get task or users or insert a new user or group via conosole.





                    • 7. Re: Transaction Issue
                      Stefano Ferrante Newbie

                      Another configuration:

                      <property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
                       <property name="hibernate.current_session_context_class">org.hibernate.context.ThreadLocalSessionContext</property>
                       <property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
                       <property name="hibernate.connection.url">jdbc:oracle:thin:@localhost:1521:XE</property>
                       <property name="hibernate.connection.username">system</property>
                       <property name="hibernate.connection.password">123</property>
                       <property name="hibernate.query.substitutions">true 1, false 0</property>
                       <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
                       <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
                      

                      same error.

                      The Transaction Manager.. is specified for JBoss i think that i can't change it for another right?..

                      Thanks in advance for any reply.




                      • 8. Re: Transaction Issue
                        Stefano Ferrante Newbie

                        Got it.
                        not more problem and with an XA DataSource. the problems was, this :

                        UserTransaction
                        Not specified in other Config files.

                        If could Help this is my final configuration:
                        XA DS Oracle (cut and past of the example under JBOSS):

                        <?xml version="1.0" encoding="UTF-8"?>
                        <datasources>
                        
                         <xa-datasource>
                         <jndi-name>JbpmDS</jndi-name>
                         <track-connection-by-tx/>
                         <isSameRM-override-value>false</isSameRM-override-value>
                         <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
                         <xa-datasource-property name="URL">jdbc:oracle:thin:@localhost:1521:XE</xa-datasource-property>
                         <xa-datasource-property name="User">system</xa-datasource-property>
                         <xa-datasource-property name="Password">123</xa-datasource-property>
                         <!--user-name>system</user-name>
                         <password>123</password-->
                         <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
                         <application-managed-security/>
                         <!-- reduce isolation from the default level (repeatable read) -->
                         <!--transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation-->
                         <!-- separate connections used with and without JTA transaction -->
                         <no-tx-separate-pools />
                         <!-- disable transaction interleaving -->
                         <!-- track-connection-by-tx /-->
                         <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker</valid-connection-checker-class-name>
                        
                         <!--mbean code="org.jboss.resource.adapter.jdbc.vendor.OracleXAExceptionFormatter"
                         name="jboss.jca:service=OracleXAExceptionFormatter">
                         <depends optional-attribute-name="TransactionManagerService">jboss:service=TransactionManager</depends>
                         </mbean-->
                        
                         <!-- corresponding type-mapping in conf/standardjbosscmp-jdbc.xml -->
                         <metadata>
                         <type-mapping>Oracle9i</type-mapping>
                         </metadata>
                         </xa-datasource>
                        
                        </datasources>
                        



                        and the Hibernate.cfg (missing just the part of all hbm.xml files):


                         <property name="hibernate.connection.datasource">java:/JbpmDS</property>
                         <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
                         <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
                         <property name="jta.UserTransaction">UserTransaction</property>
                        
                         <!-- ################################### -->
                         <!-- # common settings # -->
                         <!-- ################################### -->
                        
                         <!-- Automatic schema creation (begin) ===
                         <property name="hibernate.hbm2ddl.auto">create</property>
                         ==== Automatic schema creation (end) -->
                        
                         <!-- Simple memory-only cache -->
                         <property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
                        
                         <!-- logging properties -->
                         <property name="hibernate.format_sql">true</property>
                         <property name="hibernate.use_sql_comments">true</property>
                        



                        I hope that this can help anyone that need a start configuration.

                        Thanks for the reply .