5 Replies Latest reply on Nov 26, 2005 8:04 PM by aguizar

    hibernate problems with BPEL Extension

    joshua_hj

      Dear community,

      I was trying to put the ATM example up and running. Everything works fine at deployment time, according to the docs. I am using MySQL as database, and the Hello World example works fine. I can see the process definitions beeing deplyed and the process instances being generated.

      The thing is when running the ATM example i have an hibernate exception:

      20:40:47,895 INFO [[/atm]] messagerServlet: BPEL application stopped
      20:40:47,905 INFO [AxisService] WebService undeployed: http://runner:8080/atm/frontEnd
      20:40:48,576 INFO [EARDeployer] Undeploying J2EE application, destroy step: file:/C:/Java/jboss-4.0.2/server/bpel/deploy/atm-application.ear
      20:40:48,576 WARN [DeploymentInfo] Could not delete file:/C:/Java/jboss-4.0.2/server/bpel/tmp/deploy/tmp44799atm-application.ear restart will delete it
      20:40:48,586 INFO [EARDeployer] Init J2EE application: file:/C:/Java/jboss-4.0.2/server/bpel/deploy/atm-application.ear
      20:40:48,937 INFO [TomcatDeployer] deploy, ctxPath=/atm, warUrl=file:/C:/Java/jboss-4.0.2/server/bpel/tmp/deploy/tmp44800atm-application.ear-contents/atm-web-e
      xp.war/
      20:40:49,878 INFO [[/atm]] messagerServlet: BPEL application started: atm
      20:40:49,938 INFO [WSDLFilePublisher] WSDL published to: file:/C:/Java/jboss-4.0.2/server/bpel/data/wsdl/atm-application.ear/atm-web.war/service.wsdl
      20:40:50,169 INFO [AxisService] WSDD published to: C:\Java\jboss-4.0.2\server\bpel\data\wsdl\atm-application.ear\atm-web.war\frontEndPort.wsdd
      20:40:50,179 INFO [AxisService] Web Service deployed: http://runner:8080/atm/frontEnd
      20:40:50,219 INFO [EARDeployer] Started J2EE application: file:/C:/Java/jboss-4.0.2/server/bpel/deploy/atm-application.ear
      20:41:20,072 ERROR [AbstractBatcher] Exception executing batch:
      org.hibernate.StaleStateException: Batch update returned unexpected row count from update: 1 actual row count: 0 expected: 1
       at org.hibernate.jdbc.BatchingBatcher.checkRowCount(BatchingBatcher.java:93)
       at org.hibernate.jdbc.BatchingBatcher.checkRowCounts(BatchingBatcher.java:79)
       at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:58)
       at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:193)
       at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:91)
       at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:86)
       at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher.java:169)
       at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2162)
       at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2117)
       at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2373)
       at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:84)
       at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:243)
       at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:227)
       at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:141)
       at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:296)
       at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
       at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:905)
       at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:345)
       at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
       at org.jbpm.bpel.service.messager.StartListener.onMessage(StartListener.java:123)
       at org.jboss.mq.SpyMessageConsumer.run(SpyMessageConsumer.java:707)
       at java.lang.Thread.run(Thread.java:595)
      20:41:20,072 ERROR [AbstractFlushingEventListener] Could not synchronize database state with session
      org.hibernate.StaleStateException: Batch update returned unexpected row count from update: 1 actual row count: 0 expected: 1
       at org.hibernate.jdbc.BatchingBatcher.checkRowCount(BatchingBatcher.java:93)
       at org.hibernate.jdbc.BatchingBatcher.checkRowCounts(BatchingBatcher.java:79)
       at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:58)
       at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:193)
       at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:91)
       at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:86)
       at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher.java:169)
       at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2162)
       at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2117)
       at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2373)
       at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:84)
       at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:243)
       at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:227)
       at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:141)
       at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:296)
       at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
       at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:905)
       at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:345)
       at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
       at org.jbpm.bpel.service.messager.StartListener.onMessage(StartListener.java:123)
       at org.jboss.mq.SpyMessageConsumer.run(SpyMessageConsumer.java:707)
       at java.lang.Thread.run(Thread.java:595)
      20:41:20,132 ERROR [StartListener] could not deliver request
      org.hibernate.StaleStateException: Batch update returned unexpected row count from update: 1 actual row count: 0 expected: 1
       at org.hibernate.jdbc.BatchingBatcher.checkRowCount(BatchingBatcher.java:93)
       at org.hibernate.jdbc.BatchingBatcher.checkRowCounts(BatchingBatcher.java:79)
       at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:58)
       at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:193)
       at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:91)
       at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:86)
       at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher.java:169)
       at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2162)
       at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2117)
       at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2373)
       at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:84)
       at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:243)
       at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:227)
       at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:141)
       at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:296)
       at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
       at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:905)
       at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:345)
       at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
       at org.jbpm.bpel.service.messager.StartListener.onMessage(StartListener.java:123)
       at org.jboss.mq.SpyMessageConsumer.run(SpyMessageConsumer.java:707)
       at java.lang.Thread.run(Thread.java:595)
      20:41:20,422 INFO [DefaultLoadEventListener] Error performing load command
      org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [org.jbpm.graph.exe.Token#47]
       at org.hibernate.ObjectNotFoundException.throwIfNull(ObjectNotFoundException.java:27)
       at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:128)
       at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:161)
       at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:87)
       at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:809)
       at org.hibernate.impl.SessionImpl.load(SessionImpl.java:731)
       at org.hibernate.impl.SessionImpl.load(SessionImpl.java:724)
       at org.jbpm.bpel.service.messager.RequestListener.onMessage(RequestListener.java:89)
       at org.jboss.mq.SpyMessageConsumer.run(SpyMessageConsumer.java:707)
       at java.lang.Thread.run(Thread.java:595)
      20:41:20,422 ERROR [RequestListener] could not deliver request
      org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [org.jbpm.graph.exe.Token#47]
       at org.hibernate.ObjectNotFoundException.throwIfNull(ObjectNotFoundException.java:27)
       at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:128)
       at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:161)
       at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:87)
       at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:809)
       at org.hibernate.impl.SessionImpl.load(SessionImpl.java:731)
       at org.hibernate.impl.SessionImpl.load(SessionImpl.java:724)
       at org.jbpm.bpel.service.messager.RequestListener.onMessage(RequestListener.java:89)
       at org.jboss.mq.SpyMessageConsumer.run(SpyMessageConsumer.java:707)
       at java.lang.Thread.run(Thread.java:595)
      



      Thanks Joshua


        • 1. Re: hibernate problems with BPEL Extension
          aguizar

          If this was a configuration issue, you wouldn't be able to run the hello world example either, so it must be a problem in the environment.

          Please tell me the version numbers of your database and JDBC driver. Describe also the changes you did to the Hibernate configuration files.

          • 2. Re: hibernate problems with BPEL Extension
            joshua_hj

            Ok, thanks for such a quick reply.

            My MySQL server is 4.1.10
            Java connector is mysql-connector-java-3.1.7-bin.jar

            The hinertate config files are described below.
            The Hello World example works.
            The ATM examples returns 0 to sessioniId, so it fails on
            the first assert

            [Hibernate.properties]
            # InnoDB supports transactions
            hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect
            # could also be used, see hibernate and mysql websites for more info
            #hibernate.dialect=org.hibernate.dialect.MySQLMyISAMDialect
            #hibernate.dialect=org.hibernate.dialect.MySQLDialect
            hibernate.connection.datasource=java:/bpel
            hibernate.dialect=org.hibernate.dialect.MySQLDialect
            hibernate.connection.driver_class=com.mysql.jdbc.Driver
            hibernate.connection.url=jdbc:mysql://localhost:3306/bpel
            hibernate.connection.username=root
            hibernate.connection.password=ok
            hibernate.show_sql=false
            hibernate.query.substitutions=true 1, false 0
            
            [hibernate.cfg.xml]
            did not change nothing
            
            [jbpm-bpel-ds.xml]
            <datasources>
             <local-tx-datasource>
             <jndi-name>bpel</jndi-name>
             <connection-url>jdbc:mysql://localhost/bpel</connection-url>
             <driver-class>com.mysql.jdbc.Driver</driver-class>
             <user-name>root</user-name>
             <password>ok</password>
             <exception-sorter-class-name>
             org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter
             </exception-sorter-class-name>
             <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
             <metadata>
             <type-mapping>mySQL</type-mapping>
             </metadata>
             </local-tx-datasource>
            </datasources>
            
            [jbpm.properties]
            jbpm.session.factory.jndi.name=java:/jbpm/JbpmSessionFactory
            
            
            [jboss-service.xml]
            <server>
             <mbean code="org.jbpm.db.jmx.JbpmService"
             name="jboss.jbpm:name=DefaultJbpm,service=JbpmService"
             description="Default jBPM Service">
             <attribute name="JndiName">java:/jbpm/JbpmSessionFactory</attribute>
             <depends>jboss.jca:service=DataSourceBinding,name=bpel</depends>
             </mbean>
            </server>
            
            



            Thanks

            • 3. Re: hibernate problems with BPEL Extension
              aguizar

              I've never seen what happens if you specify both a data source and direct connection properties. They are supposed to be exclusive alternatives, so I'd pick one of them and remove the configuration properties for the other.

              • 4. Re: hibernate problems with BPEL Extension
                joshua_hj

                OK, i´ve picked the direct connection properties in hibernate.properties and it still does not work.
                Actually, i think i made that mistake of putting both connection properties because i was playing arround the config files trying to solve the problem. But i did it right the first time :) !

                # InnoDB supports transactions
                hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect
                
                hibernate.dialect=org.hibernate.dialect.MySQLDialect
                hibernate.connection.driver_class=com.mysql.jdbc.Driver
                hibernate.connection.url=jdbc:mysql://localhost:3306/bpel
                hibernate.connection.username=root
                hibernate.connection.password=ok
                hibernate.show_sql=false
                hibernate.query.substitutions=true 1, false 0
                
                


                Thanks Alex

                • 5. Re: hibernate problems with BPEL Extension
                  aguizar

                  Please make sure that:
                  doc/examples/atm/hibernate.properties and src/resources/jbpm-bpel.sar/jbpm-bpel-ds.xml use the same connection properties
                  src/resources/jbpm-bpel.sar/hibernate.properties remains unchanged, just to be sure we're on the same page
                  you have rebuilt and redeployed the jBPM BPEL service archive; you can rebuild by running target build of the Ant file build.xml