Activti 重复启动流程报错

ACT_UNIQ_HI_BUS_KEY 约束导致

点击启动的时候连续调用方法

org.activiti.engine.impl.RuntimeServiceImpl

  public ProcessInstance startProcessInstanceById(String processDefinitionId) {
    return commandExecutor.execute(new StartProcessInstanceCmd(null, processDefinitionId, null, null));
  }
连续插了两个null就导致该异常

修改类 org.activiti.engine.impl.cmd.StartProcessInstanceCmd 当businessKey为空的时候赋个GUID

 public StartProcessInstanceCmd(String processDefinitionKey, String processDefinitionId, String businessKey, Map variables) {
    this.processDefinitionKey = processDefinitionKey;
    this.processDefinitionId = processDefinitionId;
    this.businessKey = businessKey;
    if(this.businessKey==null){
          this.businessKey= UUID.randomUUID().toString();
    }
    this.variables = variables;
  }
  



你可能感兴趣的:(工作流,Java)