AnsweredAssumed Answered

org.activiti.engine.ActivitiObjectNotFoundException: no processes deployed with key 'financialReport'

Question asked by erzuomao on Apr 25, 2013
Latest reply on Nov 18, 2015 by ooactiviti
I am a Novice, I Encountered a problem when running the user guide's example.
1. Here is the test code
public static void main(String args[]){
       // Create Activiti process engine
        ProcessEngine processEngine = ProcessEngineConfiguration
         .createProcessEngineConfigurationFromResource("activiti.cfg.xml")
          .buildProcessEngine();
       
        // Get Activiti services
        RepositoryService repositoryService = processEngine.getRepositoryService();
        RuntimeService runtimeService = processEngine.getRuntimeService();
       
        // Deploy the process definition
        repositoryService.createDeployment()
          .addClasspathResource("test/NewFile.xml")
          .deploy();
         
        // Start a process instance
        runtimeService.startProcessInstanceByKey("financialReport");


   }

2.Here is the configure file
<?xml version="1.0" encoding="UTF-8"?>
<definitions id="definitions" targetNamespace="http://activiti.org/bpmn20"
   xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
   xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI"
   xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL">
   
   <process id="financialReport" name="Monthly financial report 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>

when I run the code , some errors occurred, who can help me? thanks.


Exception in thread "main" org.activiti.engine.ActivitiObjectNotFoundException: no processes deployed with key 'financialReport'
   at org.activiti.engine.impl.persistence.deploy.DeploymentManager.findDeployedLatestProcessDefinitionByKey(DeploymentManager.java:67)
   at org.activiti.engine.impl.cmd.StartProcessInstanceCmd.execute(StartProcessInstanceCmd.java:64)
   at org.activiti.engine.impl.cmd.StartProcessInstanceCmd.execute(StartProcessInstanceCmd.java:36)
   at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:61)
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:37)
   at org.activiti.engine.impl.RuntimeServiceImpl.startProcessInstanceByKey(RuntimeServiceImpl.java:54)
   at test.Test.main(Test.java:26)

Outcomes