5 Replies Latest reply on Jan 20, 2011 6:57 AM by Khursheed Ahmed

    JBPM4.0 end node error with Mysql DB

    jack asdf Newbie

      Use jbpm4.0 i have test a simple process give me mysql error !!
      processDefine file

      <?xml version="1.0" encoding="UTF-8"?>
      
      <process name="normal" xmlns="http://jbpm.org/4.0/jpdl">
       <start g="5,120,48,48" name="start1">
       <transition g="-53,-17" name="to task1" to="task1"/>
       </start>
       <end g="729,248,48,48" name="end1"/>
       <task assignee="${owner}" g="87,118,92,52" name="task1">
      
       <transition g="-53,-17" name="to fork1" to="fork1"/>
       </task>
       <task assignee="${owner}" g="324,140,92,52" name="task2">
       <transition name="to join1" to="join1" g="-53,-17"/>
       </task>
       <fork g="198,223,48,48" name="fork1">
       <transition g="-53,-17" name="to task3" to="task3"/>
       <transition g="-53,-17" name="to task2" to="task2"/>
       </fork>
       <task assignee="${owner}" g="338,258,92,52" name="task3">
       <transition name="to join1" to="join1" g="-53,-17"/>
       </task>
       <task name="task5" g="579,183,92,52" assignee="${owner}">
       <transition name="to end1" to="end1" g="-47,-17"/>
       </task>
       <join name="join1" g="517,237,48,48">
       <transition name="to task5" to="task5" g="-30,4"/>
       </join>
      </process>

      mycontroller


      package org.jackysoft.bpm.controller;
      
      import java.util.HashMap;
      import java.util.List;
      import java.util.Map;
      
      import javax.annotation.Resource;
      import javax.servlet.http.HttpServletRequest;
      import javax.servlet.http.HttpServletResponse;
      
      import org.jbpm.api.ExecutionService;
      import org.jbpm.api.HistoryService;
      import org.jbpm.api.IdentityService;
      import org.jbpm.api.ManagementService;
      import org.jbpm.api.ProcessEngine;
      import org.jbpm.api.RepositoryService;
      import org.jbpm.api.TaskService;
      import org.jbpm.api.identity.User;
      import org.jbpm.api.task.Task;
      import org.springframework.stereotype.Controller;
      import org.springframework.web.bind.annotation.RequestMapping;
      import org.springframework.web.bind.annotation.RequestParam;
      import org.springframework.web.servlet.ModelAndView;
      
      
      @Controller
      @RequestMapping("/work.htm")
      public class ProcessWork extends AbstractController{
       @Resource
       ProcessEngine processEngine;
       @Resource
       ManagementService managementService;
       @Resource
       ExecutionService executionService;
       @Resource
       RepositoryService repositoryService;
       @Resource
       HistoryService historyService;
       @Resource
       TaskService taskService;
       @Resource
       IdentityService identityService;
      
       @RequestMapping(params = "method=start")
       public ModelAndView start(
       @RequestParam("pid")String pid,
       HttpServletRequest request,
       HttpServletResponse arg1) throws Exception {
       Map<String,Object> vars =new HashMap<String,Object>();
       vars.put("owner", "john");
       executionService.startProcessInstanceById(pid, vars);
       return getMyTasks(request);
       }
      
       @RequestMapping(params = "method=dotask")
       public ModelAndView doTask(@RequestParam("tid")String tid
       ,HttpServletRequest request){
       taskService.completeTask(tid);
       return getMyTasks(request);
       }
      
      
       ModelAndView getMyTasks(HttpServletRequest request){
       ModelAndView mv= new ModelAndView("/mywork.jsp");
       User user = identityService.findUserById("john");
       List<Task> mytasks = taskService.findPersonalTasks(user.getId());
       request.setAttribute("mytasks", mytasks);
       return mv;
       }
      }

      when the process run in task node named task5 ,that 's mean next is end node
      my server throws flowwing stacks
      Hibernate:
       /* delete one-to-many org.jbpm.pvm.internal.model.ExecutionImpl.variables */ update
       JBPM4_VARIABLE
       set
       EXECUTION_=null,
       KEY_=null
       where
       EXECUTION_=?
      Hibernate:
       /* delete org.jbpm.pvm.internal.task.TaskImpl */ delete
       from
       JBPM4_TASK
       where
       DBID_=?
       and DBVERSION_=?
      Hibernate:
       /* delete org.jbpm.pvm.internal.type.variable.StringVariable */ delete
       from
       JBPM4_VARIABLE
       where
       DBID_=?
       and DBVERSION_=?
      Hibernate:
       /* delete org.jbpm.pvm.internal.model.ExecutionImpl */ delete
       from
       JBPM4_EXECUTION
       where
       DBID_=?
       and DBVERSION_=?
      [Line:100]: SQL Error: 1451, SQLState: 23000 -[org.hibernate.util.JDBCExceptionReporter.logExceptions(JDBCExceptionReporter.java:100)]-2009-07-26 14:57:20,468
      [Line:101]: Cannot delete or update a parent row: a foreign key constraint fails (`jbpm`.`jbpm4_execution`, CONSTRAINT `FK_EXEC_INSTANCE` FOREIGN KEY (`INSTANCE_`) REFERENCES `jbpm4_execution` (`DBID_`)) -[org.hibernate.util.JDBCExceptionReporter.logExceptions(JDBCExceptionReporter.java:101)]-2009-07-26 14:57:20,468
      [Line:324]: Could not synchronize database state with session -[org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:324)]-2009-07-26 14:57:20,468
      org.hibernate.exception.ConstraintViolationException: could not delete: [org.jbpm.pvm.internal.model.ExecutionImpl#1]
       at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:94)
       at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
       at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2569)
       at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2725)
       at org.hibernate.action.EntityDeleteAction.execute(EntityDeleteAction.java:97)
       at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)
       at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263)
       at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:172)
       at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
       at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
       at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1027)
       at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:365)
       at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:137)
       at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:655)
       at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:732)
       at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:701)
       at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
       at org.jbpm.pvm.internal.tx.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:79)
       at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:54)
       at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55)
       at org.jbpm.pvm.internal.svc.TaskServiceImpl.completeTask(TaskServiceImpl.java:91)
       at org.jbpm.pvm.internal.svc.TaskServiceImpl.completeTask(TaskServiceImpl.java:87)
       at org.jackysoft.bpm.controller.ProcessWork.doTask(ProcessWork.java:58)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)
       at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.doInvokeMethod(HandlerMethodInvoker.java:421)
       at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:136)
       at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:326)
       at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:313)
       at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)
       at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:807)
       at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
       at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
       at java.lang.Thread.run(Unknown Source)
      Caused by: com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (`jbpm`.`jbpm4_execution`, CONSTRAINT `FK_EXEC_INSTANCE` FOREIGN KEY (`INSTANCE_`) REFERENCES `jbpm4_execution` (`DBID_`))
       at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:931)
       at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2870)
       at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1573)
       at com.mysql.jdbc.ServerPreparedStatement.serverExecute(ServerPreparedStatement.java:1169)
       at com.mysql.jdbc.ServerPreparedStatement.executeInternal(ServerPreparedStatement.java:693)
       at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1404)
       at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1318)
       at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1303)
       at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2551)
       ... 46 more
      2009-7-26 14:57:20 org.apache.catalina.core.StandardWrapperValve invoke
      严�: Servlet.service() for servlet springapp threw exception
      com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (`jbpm`.`jbpm4_execution`, CONSTRAINT `FK_EXEC_INSTANCE` FOREIGN KEY (`INSTANCE_`) REFERENCES `jbpm4_execution` (`DBID_`))
       at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:931)
       at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2870)
       at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1573)
       at com.mysql.jdbc.ServerPreparedStatement.serverExecute(ServerPreparedStatement.java:1169)
       at com.mysql.jdbc.ServerPreparedStatement.executeInternal(ServerPreparedStatement.java:693)
       at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1404)
       at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1318)
       at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1303)
       at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2551)
       at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2725)
       at org.hibernate.action.EntityDeleteAction.execute(EntityDeleteAction.java:97)
       at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)
       at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263)
       at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:172)
       at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
       at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
       at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1027)
       at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:365)
       at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:137)
       at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:655)
       at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:732)
       at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:701)
       at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
       at org.jbpm.pvm.internal.tx.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:79)
       at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:54)
       at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55)
       at org.jbpm.pvm.internal.svc.TaskServiceImpl.completeTask(TaskServiceImpl.java:91)
       at org.jbpm.pvm.internal.svc.TaskServiceImpl.completeTask(TaskServiceImpl.java:87)
       at org.jackysoft.bpm.controller.ProcessWork.doTask(ProcessWork.java:58)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)
       at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.doInvokeMethod(HandlerMethodInvoker.java:421)
       at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:136)
       at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:326)
       at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:313)
       at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)
       at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:807)
       at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
       at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
       at java.lang.Thread.run(Unknown Source)

      i have test more than three process ,while process want to end node ,my server will give me these stacks
      [my env]

      tc6 jdk1.6 mysql 5.1 spring2.5+hibernate3.3.1