1 Reply Latest reply on Aug 10, 2007 5:25 PM by dingo dog

    Trying to run jbpm outside tomcat on mysql

    dingo dog Newbie

      I am trying to run the HelloWorldDbTest at http://docs.jboss.com/jbpm/v3.2/userguide/html/tutorial.html

      Now, I set up my hibernate.cfg.xml as

      <!-- 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/jbpmtest</property>
       <property name="hibernate.connection.username">root</property>
       <property name="hibernate.connection.password"></property>
       <!-- JDBC connection properties (end) -->
      
       <!-- DataSource properties (begin) ===
       <property name="hibernate.connection.datasource">java:/JbpmDS</property>
       ==== DataSource properties (end) -->
      


      I create the db manually from the script at /db/jbpm.jpdl.mysql.sql because of the JIRA issue here.

      But when I run the code, I get this error

      [ 10 Aug 2007 14:36:12,822],[ERROR], org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:300), Error in named query: GraphSession.deleteJobsForProcessInstance
      org.hibernate.hql.ast.QuerySyntaxError: unexpected token: job near line 3, column 36 [
      
       delete from org.jbpm.job.Job job
       where job.processInstance = :processInstance
      
       ]
       at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:63)
       at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:215)
       at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:127)
       at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83)
       at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:427)
       at org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:388)
       at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:291)
       at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1005)
       at org.jbpm.persistence.db.DbPersistenceServiceFactory.getSessionFactory(DbPersistenceServiceFactory.java:91)
       at org.jbpm.persistence.db.DbPersistenceService.getSessionFactory(DbPersistenceService.java:94)
       at org.jbpm.persistence.db.DbPersistenceService.getSession(DbPersistenceService.java:98)
       at org.jbpm.persistence.db.DbPersistenceService.getGraphSession(DbPersistenceService.java:336)
       at org.jbpm.JbpmContext.getGraphSession(JbpmContext.java:571)
       at org.jbpm.JbpmContext.deployProcessDefinition(JbpmContext.java:173)
       at org.jbpm.examples.HelloWorldDbTest.deployProcessDefinition(HelloWorldDbTest.java:108)
       at org.jbpm.examples.HelloWorldDbTest.testSimplePersistence(HelloWorldDbTest.java:80)
       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:597)
       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 junit.framework.TestSuite.runTest(TestSuite.java:208)
       at junit.framework.TestSuite.run(TestSuite.java:203)
       at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
       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)
      Caused by: line 3:36: unexpected token: job
       at org.hibernate.hql.antlr.HqlBaseParser.deleteStatement(HqlBaseParser.java:242)
       at org.hibernate.hql.antlr.HqlBaseParser.statement(HqlBaseParser.java:139)
       at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:209)
       ... 32 more
      


      Any ideas why this is happening?

        • 1. Re: Trying to run jbpm outside tomcat on mysql
          dingo dog Newbie

          Upgrade hibernate to the latest, not the old one you have running on ur hdd. for me it was hibernate3.2(latest).

          next problem will be no transaction defined or something similar. change the example code to

          jbpmConfiguration = JbpmConfiguration
           .parseXmlString("<jbpm-configuration>"
           +
          
           // A jbpm-context mechanism separates the jbpm core
           // engine from the services that jbpm uses from
           // the environment.
          
           " <jbpm-context>"
           + " <service name='persistence' "
           + " factory='org.jbpm.persistence.db.DbPersistenceServiceFactory' />"
           + " <service name='tx' factory='org.jbpm.tx.TxServiceFactory' />"
           + " </jbpm-context>"
           +
          
           // Also all the resource files that are used by jbpm are
           // referenced from the jbpm.cfg.xml
          
           " <string name='resource.hibernate.cfg.xml' "
           + " value='hibernate.cfg.xml' />"
           + " <string name='resource.business.calendar' "
           + " value='org/jbpm/calendar/jbpm.business.calendar.properties' />"
           + " <string name='resource.default.modules' "
           + " value='org/jbpm/graph/def/jbpm.default.modules.properties' />"
           + " <string name='resource.converter' "
           + " value='org/jbpm/db/hibernate/jbpm.converter.properties' />"
           + " <string name='resource.action.types' "
           + " value='org/jbpm/graph/action/action.types.xml' />"
           + " <string name='resource.node.types' "
           + " value='org/jbpm/graph/node/node.types.xml' />"
           + " <string name='resource.varmapping' "
           + " value='org/jbpm/context/exe/jbpm.varmapping.xml' />"
           + "</jbpm-configuration>");
          
          


          well, this fixed it