8 Replies Latest reply on Nov 17, 2008 9:18 AM by David Roberts

    Problem deleting a process containing a subProcess

    Meyer Violaine Newbie

      Hi,

      I'm using JBPM 3.1.2 and I have a process containing 1 sub process.
      When my processInstance has finished , I've put

       graphSession.deleteProcessInstance(processInstance.getId());
      


      But I have the error following :


      12:45:18,408 ERROR [TaskThread] The process throws exception on close:
      12:45:18,408 INFO [STDOUT] org.jbpm.JbpmException: problem closing services {persistence=org.jbpm.persistence.JbpmPersistenceException: couldn't commit hibernate session}
      12:45:18,408 INFO [STDOUT] at org.jbpm.svc.Services.close(Services.java:223)
      12:45:18,408 INFO [STDOUT] at org.jbpm.JbpmContext.close(JbpmContext.java:139)
      12:45:18,408 INFO [STDOUT] at com.editag.web.business.bean.TaskThread.run(TaskThread.java:112)
      12:45:18,408 INFO [STDOUT] Caused by: org.jbpm.persistence.JbpmPersistenceException: couldn't commit hibernate session
      12:45:18,408 INFO [STDOUT] at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:172)
      12:45:18,408 INFO [STDOUT] at org.jbpm.svc.Services.close(Services.java:211)
      12:45:18,408 INFO [STDOUT] ... 2 more
      12:45:18,408 INFO [STDOUT] Caused by: org.hibernate.exception.ConstraintViolationException: could not delete: [org.jbpm.graph.exe.Token#2355]
      12:45:18,408 INFO [STDOUT] at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:69)
      12:45:18,408 INFO [STDOUT] at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
      12:45:18,428 INFO [STDOUT] at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2307)
      12:45:18,428 INFO [STDOUT] at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2439)
      12:45:18,428 INFO [STDOUT] at org.hibernate.action.EntityDeleteAction.execute(EntityDeleteAction.java:65)
      12:45:18,428 INFO [STDOUT] at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:243)
      12:45:18,428 INFO [STDOUT] at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:227)
      12:45:18,428 INFO [STDOUT] at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:145)
      12:45:18,428 INFO [STDOUT] at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:296)
      12:45:18,428 INFO [STDOUT] at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
      12:45:18,428 INFO [STDOUT] at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:905)
      12:45:18,428 INFO [STDOUT] at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:345)
      12:45:18,428 INFO [STDOUT] at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
      12:45:18,428 INFO [STDOUT] at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:162)
      12:45:18,428 INFO [STDOUT] ... 3 more
      12:45:18,428 INFO [STDOUT] Caused by: java.sql.SQLException: Integrity constraint violation FK_PROCIN_SPROCTKN table: JBPM_PROCESSINSTANCE in statement [delete from JBPM_TOKEN where ID_=? and VERSION_=?]
      12:45:18,428 INFO [STDOUT] at org.hsqldb.jdbc.Util.throwError(Unknown Source)
      12:45:18,428 INFO [STDOUT] at org.hsqldb.jdbc.jdbcPreparedStatement.executeUpdate(Unknown Source)
      12:45:18,438 INFO [STDOUT] at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:227)
      12:45:18,438 INFO [STDOUT] at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2293)
      12:45:18,438 INFO [STDOUT] ... 14 more


      I've found answers to my question for more recently versions but I can't change my version. Can someone help me ?

      Thank you.


        • 1. Re: Problem deleting a process containing a subProcess
          Ronald van Kuijk Master

          you can't upgrade to 3.1.4 (though I'm not sure if it is fixed there)

          • 2. Re: Problem deleting a process containing a subProcess
            Meyer Violaine Newbie

            Hi,

            I've change to JBPM 3.2.GA but my problem is still there.
            I have the error :


            3:06:03,439 ERROR [JDBCExceptionReporter] Integrity constraint violation FK_PROCIN_SPROCTKN table: JBPM_PROCESSINSTANCE in statement [delete from JBPM_TOKEN where ID_=? and VERSION_=?]
            13:06:03,439 ERROR [AbstractFlushingEventListener] Could not synchronize database state with session
            org.hibernate.exception.ConstraintViolationException: could not delete: [org.jbpm.graph.exe.Token#11]
            at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:69)
            at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
            at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2307)
            at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2439)
            at org.hibernate.action.EntityDeleteAction.execute(EntityDeleteAction.java:65)
            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:145)
            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.persistence.db.DbPersistenceService.commit(DbPersistenceService.java:253)
            at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:211)
            at org.jbpm.svc.Services.close(Services.java:222)
            at org.jbpm.JbpmContext.close(JbpmContext.java:139)
            at com.editag.process.ProcessExecutorThread.run(ProcessExecutorThread.java:193)
            Caused by: java.sql.SQLException: Integrity constraint violation FK_PROCIN_SPROCTKN table: JBPM_PROCESSINSTANCE in statement [delete from JBPM_TOKEN where ID_=? and VERSION_=?]
            at org.hsqldb.jdbc.Util.throwError(Unknown Source)
            at org.hsqldb.jdbc.jdbcPreparedStatement.executeUpdate(Unknown Source)
            at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:227)
            at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2293)
            ... 15 more
            13:06:03,449 ERROR [DbPersistenceService] hibernate commit failed
            org.hibernate.exception.ConstraintViolationException: could not delete: [org.jbpm.graph.exe.Token#11]
            at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:69)
            at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
            at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2307)
            at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2439)
            at org.hibernate.action.EntityDeleteAction.execute(EntityDeleteAction.java:65)
            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:145)
            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.persistence.db.DbPersistenceService.commit(DbPersistenceService.java:253)
            at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:211)
            at org.jbpm.svc.Services.close(Services.java:222)
            at org.jbpm.JbpmContext.close(JbpmContext.java:139)
            at com.editag.process.ProcessExecutorThread.run(ProcessExecutorThread.java:193)
            Caused by: java.sql.SQLException: Integrity constraint violation FK_PROCIN_SPROCTKN table: JBPM_PROCESSINSTANCE in statement [delete from JBPM_TOKEN where ID_=? and VERSION_=?]
            at org.hsqldb.jdbc.Util.throwError(Unknown Source)
            at org.hsqldb.jdbc.jdbcPreparedStatement.executeUpdate(Unknown Source)
            at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:227)
            at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2293)
            ... 15 more



            Can anyone help me ?


            • 3. Re: Problem deleting a process containing a subProcess
              Martin Weiler Apprentice

              what DB are you working with?

              A similar issue has been reported in JIRA http://jira.jboss.com/jira/browse/JBPM-785 with MySQL5, but due to the lack of a unit test the suggested patch was rejected. Maybe you could provide this to get the issue resolved...

              • 4. Re: Problem deleting a process containing a subProcess
                Meyer Violaine Newbie

                Currently, I'm working with HSQLDB, but we will soon change DB to postgresql or mysql

                • 5. Re: Problem deleting a process containing a subProcess
                  Meyer Violaine Newbie

                  I tried JBPM-JPDL-3.2.GA but I have the same problem.

                  I tried this solution : http://www.jboss.com/index.html?module=bb&op=viewtopic&t=94196
                  but it just move the problem, I have a violation constraint on JBPM_LOG.

                  The only way to delete process instances properly is to modify the database like : http://www.jboss.com/index.html?module=bb&op=viewtopic&t=113885
                  but every time I'll change database I must modify its script.

                  Is there really no solution ?

                  • 6. Re: Problem deleting a process containing a subProcess
                    David Roberts Apprentice

                    I am on Jbpm 3.2.3, using MySQL 5 db.
                    I am also having this problem (can't delete a process if it has a sub-process attached).

                    I have also tried the solution at: http://www.jboss.com/index.html?module=bb&op=viewtopic&t=94196
                    and I also get a constraint violation on JBPM_LOG.

                    I have also looked at http://www.jboss.com/index.html?module=bb&op=viewtopic&t=113885, but no one replied to the post, and I don't like the idea of changing the database and deviating from the Jbpm standard release - I'd rather it be an official Jbpm change if it were to happen.

                    I have also looked at Jira issue https://jira.jboss.org/jira/browse/JBPM-785 which explains the problem, but it was rejected and closed. Apparently, if someone could supply a unit test, Tom could look into it again. Has anyone got a unit test they could supply? I would love to supply one if I knew how. Perhaps when I find some time I can look into it.

                    This problem seems to be over 2 years old. Does anyone know if there are any working solutions or fixes? I'm sure a lot of people would be very appreciative.

                    • 7. Re: Problem deleting a process containing a subProcess
                      Ronald van Kuijk Master

                       

                      I would love to supply one if I knew how.


                      There are many examples in the jBPM source

                      • 8. Re: Problem deleting a process containing a subProcess
                        David Roberts Apprentice

                        Okay, I managed to get deleting a process which includes sub processes working (I hope properly). I posted my findings here: http://www.jboss.com/index.html?module=bb&op=viewtopic&t=94196