12 Replies Latest reply on Aug 7, 2006 6:47 AM by Claus Wittmann

    DB Error deploying the Sample BPEL process

    Kartik Mecheri Newbie

      Hello
      I get the following error while deploying the hello bpel process.

      I am running jboss 4.0.2 and jbpm-bpel1.0-alpha3.


      [deploypar] 17:19:25,916 DEBUG BpelReader : upgraded bpel document: hello.bpel
      [deploypar] 17:19:25,996 INFO BpelReader : read bpel process: hello.bpel
      [deploypar] 17:19:26,267 DEBUG ProcessArchiveDeployer : starting transaction to deploy process BpelDefinition(helloWorld)
      [deploypar] Hibernate: select processdef0_.ID_ as col_0_0_ from JBPM_PROCESSDEFINITION processdef0_ where processdef0_.NAME_=? order by processdef0_.VERSION_ desc
      [deploypar] Hibernate: insert into JBPM_PROCESSDEFINITION (NAME_, VERSION_, ISTERMINATIONIMPLICIT_, STARTSTATE_, TARGETNAMESPACE_, ENABLECOMPENSATION_, EXPRESSIONLANG_, QUERYLANG_, ABSTRACT_, CLASS_) values (?, ?, ?, ?, ?, ?, ?, ?, ?, 'B')
      [deploypar] Hibernate: insert into JBPM_NODE (NAME_, PROCESSDEFINITION_, ACTION_, SUPERSTATE_, SUPRJOINFAILURE_, COMPOSITEACTIVITY_, JOINCONDITION_, IMPLICIT_, ISOLATED_, CLASS_) values (?, ?, ?, ?, ?, ?, ?, ?, ?, 'O')
      [deploypar] Hibernate: insert into JBPM_NODE (NAME_, PROCESSDEFINITION_, ACTION_, SUPERSTATE_, SUPRJOINFAILURE_, COMPOSITEACTIVITY_, JOINCONDITION_, CLASS_) values (?, ?, ?, ?, ?, ?, ?, 'i')
      [deploypar] 17:19:27,799 WARN JDBCExceptionReporter : SQL Error: 2601, SQLState: S1000
      [deploypar] 17:19:27,799 ERROR JDBCExceptionReporter : Attempt to insert duplicate key row in object 'JBPM_NODE' with unique index 'JBPM_NODE_WHILE__20007231492'
      [deploypar] 17:19:27,799 ERROR GraphSession : org.hibernate.exception.GenericJDBCException: could not insert: [org.jbpm.bpel.def.Sequence]
      [deploypar] 17:19:27,869 WARN JbpmSession : can't pop current session: are you calling JbpmSession.close() multiple times ?
      [deploypar] java.lang.RuntimeException: couldn't save process definition 'BpelDefinition(helloWorld)'
      [deploypar] at org.jbpm.db.GraphSession.saveProcessDefinition(GraphSession.java:35)
      [deploypar] at org.jbpm.jpdl.par.ProcessArchiveDeployer.deployProcessDefinition(ProcessArchiveDeployer.java:77)
      [deploypar] at org.jbpm.jpdl.par.ProcessArchiveDeployer.deployZipInputStream(ProcessArchiveDeployer.java:47)
      [deploypar] at org.jbpm.ant.DeployParTask.deploy(DeployParTask.java:69)
      [deploypar] at org.jbpm.ant.DeployParTask.execute(DeployParTask.java:57)
      [deploypar] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
      [deploypar] at org.apache.tools.ant.Task.perform(Task.java:364)
      [deploypar] at org.apache.tools.ant.Target.execute(Target.java:341)
      [deploypar] at org.apache.tools.ant.Target.performTasks(Target.java:369)
      [deploypar] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
      [deploypar] at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
      [deploypar] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
      [deploypar] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
      [deploypar] at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
      [deploypar] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
      [deploypar] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
      [deploypar] Caused by: org.hibernate.exception.GenericJDBCException: could not insert: [org.jbpm.bpel.def.Sequence]
      [deploypar] at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:82)
      [deploypar] at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:70)
      [deploypar] at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
      [deploypar] at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:1777)
      [deploypar] at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:2178)
      [deploypar] at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:34)
      [deploypar] at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239)
      [deploypar] at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:240)
      [deploypar] at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:160)
      [deploypar] at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:95)
      [deploypar] at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:184)
      [deploypar] at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:173)
      [deploypar] at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:96)
      [deploypar] at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:69)
      [deploypar] at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:468)
      [deploypar] at org.hibernate.engine.Cascades$5.cascade(Cascades.java:154)
      [deploypar] at org.hibernate.engine.Cascades.cascadeAssociation(Cascades.java:771)
      [deploypar] at org.hibernate.engine.Cascades.cascade(Cascades.java:720)
      [deploypar] at org.hibernate.engine.Cascades.cascade(Cascades.java:847)
      [deploypar] at org.hibernate.event.def.AbstractSaveEventListener.cascadeAfterSave(AbstractSaveEventListener.java:363)
      [deploypar] at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:265)
      [deploypar] at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:160)
      [deploypar] at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:95)
      [deploypar] at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:184)
      [deploypar] at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:173)
      [deploypar] at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:96)
      [deploypar] at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:69)
      [deploypar] at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:468)
      [deploypar] at org.hibernate.engine.Cascades$5.cascade(Cascades.java:154)
      [deploypar] at org.hibernate.engine.Cascades.cascadeAssociation(Cascades.java:771)
      [deploypar] at org.hibernate.engine.Cascades.cascade(Cascades.java:720)
      [deploypar] at org.hibernate.engine.Cascades.cascadeCollection(Cascades.java:895)
      [deploypar] at org.hibernate.engine.Cascades.cascadeAssociation(Cascades.java:792)
      [deploypar] at org.hibernate.engine.Cascades.cascade(Cascades.java:720)
      [deploypar] at org.hibernate.engine.Cascades.cascade(Cascades.java:847)
      [deploypar] at org.hibernate.event.def.AbstractSaveEventListener.cascadeAfterSave(AbstractSaveEventListener.java:363)
      [deploypar] at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:265)
      [deploypar] at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:160)
      [deploypar] at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:95)
      [deploypar] at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:184)
      [deploypar] at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
      [deploypar] at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:173)
      [deploypar] at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)
      [deploypar] at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:69)
      [deploypar] at org.hibernate.impl.SessionImpl.save(SessionImpl.java:481)
      [deploypar] at org.hibernate.impl.SessionImpl.save(SessionImpl.java:476)
      [deploypar] at org.jbpm.db.GraphSession.saveProcessDefinition(GraphSession.java:31)
      [deploypar] ... 15 more
      [deploypar] Caused by: java.sql.SQLException: Attempt to insert duplicate key row in object 'JBPM_NODE' with unique index 'JBPM_NODE_WHILE__20007231492'
      [deploypar] at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:364)
      [deploypar] at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2754)
      [deploypar] at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2195)
      [deploypar] at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:620)
      [deploypar] at net.sourceforge.jtds.jdbc.JtdsStatement.processResults(JtdsStatement.java:483)
      [deploypar] at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQL(JtdsStatement.java:445)
      [deploypar] at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.executeUpdate(JtdsPreparedStatement.java:402)
      [deploypar] at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:104)
      [deploypar] at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:1759)
      [deploypar] ... 58 more

      BUILD FAILED
      C:\bpel_new\doc\examples\hello\build.xml:105: couldn't deploy process archives : couldn't save process definition 'BpelDefinition(helloWorld)'

      Total time: 32 seconds

        • 1. Re: DB Error deploying the Sample BPEL process
          Alejandro Guizar Master

          You're using mssql and the jtds driver, right? What versions?

          • 2. Re: DB Error deploying the Sample BPEL process
            Kartik Mecheri Newbie

            I am using Sybase 12.5.2 not MSSQL...I am using the jtds driver that comes with the jbpm-starters-kit distribution...the version is 1.1.

            • 3. Re: DB Error deploying the Sample BPEL process
              Alejandro Guizar Master

              Alright. What are the results of running the database tests (the target sybase.test of the build file in jbpm.db) against your version of Sybase?

              • 4. Re: DB Error deploying the Sample BPEL process
                Kartik Mecheri Newbie

                Alex.
                First of all thanks for the quick response. I didnt run that test. Just to make sure, I am running the bpel example. I was able to create the schema(ant create-schema) successfully. It is during deployment of the definition (ant deploy-dfinition) that I get the error. In the meantime, I will run the db test for Sybase and get back to you.

                Thanks again.

                • 5. Re: DB Error deploying the Sample BPEL process
                  Kartik Mecheri Newbie

                  Alex.
                  I am not able to run the tests successfully. I read the documentation and all the necessary libraries and classpath seem to be set right. This is the error I get

                  BUILD FAILED
                  C:\jbpm\workspace\jbpm.db\build.xml:393: The following error occurred while executing this line:
                  C:\jbpm\workspace\jbpm.db\build.xml:85: Could not create task or type of type: junit.

                  Ant could not find the task or a class this task relies upon.

                  This is common and has a number of causes; the usual
                  solutions are to read the manual pages then download and
                  install needed JAR files, or fix the build file:
                  - You have misspelt 'junit'.
                  Fix: check your spelling.
                  - The task needs an external JAR file to execute
                  and this is not found at the right place in the classpath.
                  Fix: check the documentation for dependencies.
                  Fix: declare the task.
                  - The task is an Ant optional task and the JAR file and/or libraries
                  implementing the functionality were not found at the time you
                  yourself built your installation of Ant from the Ant sources.
                  Fix: Look in the ANT_HOME/lib for the 'ant-' JAR corresponding to the
                  task and make sure it contains more than merely a META-INF/MANIFEST.MF.
                  If all it contains is the manifest, then rebuild Ant with the needed
                  libraries present in ${ant.home}/lib/optional/ , or alternatively,
                  download a pre-built release version from apache.org
                  - The build file was written for a later version of Ant
                  Fix: upgrade to at least the latest release version of Ant
                  - The task is not an Ant core or optional task
                  and needs to be declared using .
                  - You are attempting to use a task defined using
                  or but have spelt wrong or not
                  defined it at the point of use

                  Remember that for JAR files to be visible to Ant tasks implemented
                  in ANT_HOME/lib, the files must be in the same directory or on the
                  classpath

                  Please neither file bug reports on this problem, nor email the
                  Ant mailing lists, until all of these causes have been explored,
                  as this is not an Ant bug.

                  Total time: 4 seconds

                  • 6. Re: DB Error deploying the Sample BPEL process
                    Kartik Mecheri Newbie


                    Alright. I got it to work and the test ran fine. here are some of the statistics..

                    [junit] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 36.773 sec
                    [junitreport] Transform time: 8382ms
                    BUILD SUCCESSFUL
                    Total time: 16 minutes 17 seconds

                    Thanks

                    • 7. Re: DB Error deploying the Sample BPEL process
                      Kartik Mecheri Newbie

                      I ran the db test as you suggested and it worked fin (my previous post).
                      The one thing I noticed is the following SQL statements during deployment of the hello-bpel.
                      Hibernate: insert into JBPM_NODE (NAME_, PROCESSDEFINITION_, ACTION_, SUPERSTATE_, SUPRJOINFAILURE_, COMPOSITEACTIVITY_, JOINCONDITION_, IMPLICIT_, ISOLATED_, CLASS_) values (?, ?, ?, ?, ?, ?, ?, ?, ?, 'O')
                      [deploypar] Hibernate: insert into JBPM_NODE (NAME_, PROCESSDEFINITION_, ACTION_, SUPERSTATE_, SUPRJOINFAILURE_, COMPOSITEACTIVITY_, JOINCONDITION_, CLASS_) values (?, ?, ?, ?, ?, ?, ?, 'i')

                      In both cases, there is no entry into the WHILE_ field in the database. When I looked at the db I found out that the WHILE_ field in the JBPM_NODE table is a nullable field and has a unique index defined and thats why it throws the error. Now, my question is, is this table JBPM_NODE different in the BPEL implementation from the plain jbpm version?

                      Thank you

                      Kartik

                      • 8. Re: DB Error deploying the Sample BPEL process
                        Alejandro Guizar Master

                        Thanks for confirming the DB tests work. Regarding your question, each BPEL activity is a subclass of the jBPM Node. We mapped this class with the table-per-class-hierarchy strategy. Hence the BPEL extension creates more fields in the JBPM_NODE table than the plain jBPM.

                        The WHILE_ field points from a node introduced behind the scenes to control looping back to the while activity. This is an unidirectional one-to-one association on a foreign key. In adherance to the Hibernate reference, the foreign key column specifies a unique constraint.

                        The mapping document for all structured activities resides in src/bpel/org/jbpm/bpel/def/StructuredActivity.hbm.xml. It contains the mapping for the loop node:

                        <!--Loop Node-->
                         <subclass
                         name="org.jbpm.bpel.def.While$LoopNode"
                         extends="org.jbpm.bpel.def.Activity"
                         discriminator-value="L"
                         lazy="false">
                         <many-to-one
                         name="whileActivity"
                         column="WHILE_"
                         foreign-key="FK_LOOP_WHILE"
                         unique="true" />
                         </subclass>

                        MySQL, PostreSQL, Oracle and Hypersonic behave "as expected". They don't consider that the appearance of a null value in more than one row violates the unique constraint. If Sybase doesn't think so, just delete the unique attribute from the mapping document. Also remember to delete that attribute from the StructureStart and StructureEnd mappings. Other occurences are ScopeHandler.scope (ScopeHandler.hbm.xml) and Assign$Copy.from / to (Activity.hbm.xml).

                        Let me know if this works.

                        • 9. Re: DB Error deploying the Sample BPEL process
                          Kartik Mecheri Newbie

                          Thanks a lot for the full clarification on the table. I made the changes and was successfully able to deploy. Once again, thanks a million for the help.

                          • 10. Re: DB Error deploying the Sample BPEL process
                            Alejandro Guizar Master

                            Could you open a JIRA issue for incorporating these changes to the next release of the BPEL extension?

                            • 11. Re: DB Error deploying the Sample BPEL process
                              Claus Wittmann Newbie

                              Hi there!

                              I got the same Ant error:
                              BUILD FAILED
                              C:\EWorkspace\bpel-test\jbpm.bpel\doc\examples\process.template.xml:240: Could not create task or type of type: junit.

                              Ant could not find the task or a class this task relies upon.

                              This is common and has a number of causes; the usual
                              solutions are to read the manual pages then download and
                              install needed JAR files, or fix the build file:
                              - You have misspelt 'junit'.
                              Fix: check your spelling.
                              - The task needs an external JAR file to execute
                              and this is not found at the right place in the classpath.
                              Fix: check the documentation for dependencies.
                              Fix: declare the task.
                              - The task is an Ant optional task and the JAR file and/or libraries
                              implementing the functionality were not found at the time you
                              yourself built your installation of Ant from the Ant sources.
                              Fix: Look in the ANT_HOME/lib for the 'ant-' JAR corresponding to the
                              task and make sure it contains more than merely a META-INF/MANIFEST.MF.
                              If all it contains is the manifest, then rebuild Ant with the needed
                              libraries present in ${ant.home}/lib/optional/ , or alternatively,
                              download a pre-built release version from apache.org
                              - The build file was written for a later version of Ant
                              Fix: upgrade to at least the latest release version of Ant
                              - The task is not an Ant core or optional task
                              and needs to be declared using .
                              - You are attempting to use a task defined using
                              or but have spelt wrong or not
                              defined it at the point of use

                              Remember that for JAR files to be visible to Ant tasks implemented
                              in ANT_HOME/lib, the files must be in the same directory or on the
                              classpath

                              Please neither file bug reports on this problem, nor email the
                              Ant mailing lists, until all of these causes have been explored,
                              as this is not an Ant bug.

                              Total time: 938 milliseconds

                              Does anyone know what the reason could be?

                              My config:
                              Eclipse 3.1.2
                              Original Hybernate Database
                              Helloworld.bpel - run-test
                              (\doc\examples\build.xml\ run-test by ant)

                              Thanks in advance!
                              Greetings Claus

                              • 12. Re: DB Error deploying the Sample BPEL process
                                Claus Wittmann Newbie

                                I cannot believe that no one knows the sollution for such a common problem!?
                                Now I have found It on my own.

                                Search for your own Hehe :-)

                                No here is the sollution:

                                The Connection of Junit to ant was missing in Eclipse
                                So start Eclipse and go to
                                Window -> Preferences -> Ant -> Runtime -> Classpath Tab -> Global Entries -> Add External Jars
                                \eclipse_home_dir\plugins\org.junit_3.8.1\junit.jar


                                Thats all. Now the error was gone.

                                Greetings

                                Claus