cancel
Showing results for 
Search instead for 
Did you mean: 

Can not find *.bpmn20.xml file

yhxjldx
Champ in-the-making
Champ in-the-making
I copy code from user guide,and make some change. "Deployment deployment = (Deployment) repositoryService.createDeployment().addClasspathResource(flowwork).deploy();" is error. error info is "Exception in thread "main" org.activiti.engine.ActivitiException: resource 'F:/activiti-5.9/workspace/testactivitione/src/main/resources/diagrams/MyProcess.bpmn20.xml' not found". 
this is classpath and xml path:'F:/activiti-5.9/workspace/testactivitione/src/main/resources/diagrams/MyProcess.bpmn20.xml'  and "F:\activiti-5.9\workspace\testactivitione\src\main\java\testactiviti\Testnew.java".

public static void main(String[] args) {
      RuntimeService runtimeService;
      TaskService taskService;
      ProcessEngine processEngine = ProcessEngineConfiguration
            .createStandaloneInMemProcessEngineConfiguration()
            .buildProcessEngine();
      String flowwork = "F:/activiti-5.9/workspace/testactivitione/src/main/resources/diagrams/MyProcess.bpmn20.xml";
      String flowworkpng = "F:/activiti-5.9/workspace/testactivitione/src/main/resources/diagrams/MyProcess.png";
      RepositoryService repositoryService = processEngine
            .getRepositoryService();
      Deployment deployment = (Deployment) repositoryService.createDeployment()
              .addClasspathResource(flowwork)
              .deploy();
      runtimeService = processEngine.getRuntimeService();
      taskService = processEngine.getTaskService();
      runtimeService.startProcessInstanceByKey("MyProcess");
      Task task = taskService.createTaskQuery().singleResult();
      //assertEquals("MyProcess", task.getName());
      taskService.complete(task.getId());
      //assertEquals(0, runtimeService.createProcessInstanceQuery().count());
   }
2 REPLIES 2

erny18031
Champ in-the-making
Champ in-the-making
Short: flowwork should just be: "diagrams/MyProcess.bpmn20.xml".

Long: You are using a absolute path when calling .addClassPathResource. For each entry in classpath, your complete path is appended to see if the file could be found.

Regards.
Erny

yhxjldx
Champ in-the-making
Champ in-the-making
Short: flowwork should just be: "diagrams/MyProcess.bpmn20.xml".

Long: You are using a absolute path when calling .addClassPathResource. For each entry in classpath, your complete path is appended to see if the file could be found.

Regards.
Erny
Thanks . I change the absolute path to diagrams/MyProcess.bpmn20.xml . the workflow run successfully.