无法部署进程活动

时间:2016-05-17 10:08:04

标签: java deployment activiti

每个人都有什么。你好吗?我需要你对activiti的帮助。我是新手,我正在尝试从activiti user guide实施activiti示例,但我的流程没有被部署......没有错误,没有任何错误。 我的java代码是:

public static void main(String[] args) {
   // TODO Auto-generated method stub
   ProcessEngine processEngine = null;
   ProcessEngineConfiguration processConfig= null;
   processConfig =  ProcessEngineConfiguration.createProcessEngineConfigurationFromResourceDefault();

   processEngine = processConfig.buildProcessEngine();
   //Get Activiti services
   RepositoryService repositoryService = processEngine.getRepositoryService();
    RuntimeService runtimeService = processEngine.getRuntimeService();

    //Deploy the process definition
    repositoryService.createDeployment()
        .addClasspathResource("diagrams/FinancialReportProcess.bpmn20.xml")
        .deploy();
        System.out.println("Your process should be deployed...");

    //Start a process instance
    runtimeService.startProcessInstanceByKey("financialReport");
        System.out.println("Your process should be started...");


    // Get the first task
    TaskService taskService = processEngine.getTaskService();
    List<Task> tasks = taskService.createTaskQuery().taskCandidateGroup("accountancy").list();
    for (Task task : tasks) {
      System.out.println("Following task is available for accountancy group: " + task.getName());

      // claim it
      taskService.claim(task.getId(), "fozzie");
    }

    // Verify Fozzie can now retrieve the task
    tasks = taskService.createTaskQuery().taskAssignee("fozzie").list();
    for (Task task : tasks) {
      System.out.println("Task for fozzie: " + task.getName());

      // Complete the task
      taskService.complete(task.getId());
    }

    System.out.println("Number of tasks for fozzie: "
            + taskService.createTaskQuery().taskAssignee("fozzie").count());

    // Retrieve and claim the second task
    tasks = taskService.createTaskQuery().taskCandidateGroup("management").list();
    for (Task task : tasks) {
      System.out.println("Following task is available for management group: " + task.getName());
      taskService.claim(task.getId(), "kermit");
    }

    // Completing the second task ends the process
    for (Task task : tasks) {
      taskService.complete(task.getId());
    }
  }

我的FinancialReportProcess.bpmn20.xml代码是:

 <?xml version="1.0" encoding="UTF-8"?>

 <definitions id="definitions"
  targetNamespace="http://activiti.org/bpmn20"
  xmlns:activiti="http://activiti.org/bpmn"
  xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL">

<process id="financialReport" name="Monthly financial report reminder process">

  <startEvent id="theStart" />

  <sequenceFlow id='flow1' sourceRef='theStart' targetRef='writeReportTask' />

  <userTask id="writeReportTask" name="Write monthly financial report" >
    <documentation>
      Write monthly financial report for publication to shareholders.
    </documentation>
    <potentialOwner>
      <resourceAssignmentExpression>
        <formalExpression>accountancy</formalExpression>
      </resourceAssignmentExpression>
    </potentialOwner>
  </userTask>

  <sequenceFlow id='flow2' sourceRef='writeReportTask' targetRef='verifyReportTask' />

  <userTask id="verifyReportTask" name="Verify monthly financial report" >
    <documentation>
      Verify monthly financial report composed by the accountancy department.
      This financial report is going to be sent to all the company shareholders.
    </documentation>
    <potentialOwner>
      <resourceAssignmentExpression>
        <formalExpression>management</formalExpression>
      </resourceAssignmentExpression>
    </potentialOwner>
  </userTask>

  <sequenceFlow id='flow3' sourceRef='verifyReportTask' targetRef='theEnd' />

  <endEvent id="theEnd" />

</process>

</definitions>

我需要修复什么,所以我可以部署我的流程。 感谢你的时间

1 个答案:

答案 0 :(得分:0)

我认为你应该像这样初始化你的流程引擎,

ProcessEngine processEngine = ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration()                 .setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_FALSE)                 .setJdbcUrl(“你的jdbc url”)                 .setJdbcUsername( “用户名”)                 .setJdbcPassword( “密码”)                 .setAsyncExecutorEnabled(真)                 .setAsyncExecutorActivate(假)                 .buildProcessEngine();