1 Reply Latest reply on Mar 30, 2007 4:52 AM by kukeltje

    Strange behaviour running with MySQL in JBoss server

    ghinwa

      I have been trying to use jBPM inside the App server, using MySQL. inside my jar file, in hibernate.cfg.xml I have the following:

       <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
       <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
       <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/jbpmdb</property>
       <property name="hibernate.connection.username">sa</property>
       <property name="hibernate.connection.password">sa</property>
      

      and in the session bean method I create the JbpmContext, perform some process definition deployment, and then close the context. Everything seems to work well and the process definition gets stored in the db.
      However, when I try to specify the db connection as a data source, i.e. change the config in hibernate.cfg.xml to the following instead:

       <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
       <property name="hibernate.connection.datasource">java:/JbpmDS</property>
      


      and create a datasource definition in the deploy dir containing:
       <local-tx-datasource>
       <jndi-name>JbpmDS</jndi-name>
       <connection-url>jdbc:mysql://localhost:3306/jbpmdb</connection-url>
       <driver-class>com.mysql.jdbc.Driver</driver-class>
       <user-name>sa</user-name>
       <password>sa</password>
       <exception-sorter-class-name>
       org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter
       </exception-sorter-class-name>
       <metadata>
       <type-mapping>MySQL</type-mapping>
       </metadata>
       </local-tx-datasource>
      


      and I run the same code, I notice that the process data in the jbpm_processdefinition table contains NULL in the STARTSTATE_ field (but the remaining fields for process name, version, etc. are populated properly).... Any subsequent attempt to instantiate a process based on this definition fails (due to the null in the foreign key I suppose)

      I have tried adding to hibernate.cfg.xml the following:
       <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>
      

      with the side effect of not having to close() jbpm context... however the erroneous behaviour above persisted...

      Any insight into this would be appreciated. I am new to jBPM, have read the tutorial and searched TFF :) however may have missed something obvious....

      Thanks.

        • 1. Re: Strange behaviour running with MySQL in JBoss server
          kukeltje

          I would have no qlue, since I use jBPM with MySQL the same way you do and do not see this problem. Could it be related to different drivers for each of the configs? e.g. one newer in the war/ear (used with the first config) and an older one on the classpath (used with the second config?)