AnsweredAssumed Answered

Can not deploy process

Question asked by kebo on Mar 4, 2014
Latest reply on Mar 4, 2014 by kebo
Hi,
I started with activiti and I found problem on first steps. I copy and paste vacationRequest from activti guide:

<?xml version="1.0" encoding="UTF-8" ?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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" typeLanguage="http://www.w3.org/2001/XMLSchema"
   expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">

   <process id="vacationRequest" name="Vacation request">

      <startEvent id="request" activiti:initiator="employeeName">
         <extensionElements>
            <activiti:formProperty id="numberOfDays" name="Number of days"
               type="long" value="1" required="true" />
            <activiti:formProperty id="startDate"
               name="First day of holiday (dd-MM-yyy)" datePattern="dd-MM-yyyy hh:mm"
               type="date" required="true" />
            <activiti:formProperty id="vacationMotivation"
               name="Motivation" type="string" />
         </extensionElements>
      </startEvent>
      <sequenceFlow id="flow1" sourceRef="request" targetRef="handleRequest" />

      <userTask id="handleRequest" name="Handle vacation request">
         <documentation>
            ${employeeName} would like to take ${numberOfDays} day(s) of vacation (Motivation:
            ${vacationMotivation}).
         </documentation>
         <extensionElements>
            <activiti:formProperty id="vacationApproved"
               name="Do you approve this vacation" type="enum" required="true">
               <activiti:value id="true" name="Approve" />
               <activiti:value id="false" name="Reject" />
            </activiti:formProperty>
            <activiti:formProperty id="managerMotivation"
               name="Motivation" type="string" />
         </extensionElements>
         <potentialOwner>
            <resourceAssignmentExpression>
               <formalExpression>management</formalExpression>
            </resourceAssignmentExpression>
         </potentialOwner>
      </userTask>
      <sequenceFlow id="flow2" sourceRef="handleRequest"
         targetRef="requestApprovedDecision" />

      <exclusiveGateway id="requestApprovedDecision" name="Request approved?" />
      <sequenceFlow id="flow3" sourceRef="requestApprovedDecision"
         targetRef="sendApprovalMail">
         <conditionExpression xsi:type="tFormalExpression">${vacationApproved
            == 'true'}</conditionExpression>
      </sequenceFlow>

      <task id="sendApprovalMail" name="Send confirmation e-mail" />
      <sequenceFlow id="flow4" sourceRef="sendApprovalMail"
         targetRef="theEnd1" />
      <endEvent id="theEnd1" />

      <sequenceFlow id="flow5" sourceRef="requestApprovedDecision"
         targetRef="adjustVacationRequestTask">
         <conditionExpression xsi:type="tFormalExpression">${vacationApproved
            == 'false'}</conditionExpression>
      </sequenceFlow>

      <userTask id="adjustVacationRequestTask" name="Adjust vacation request">
         <documentation>
            Your manager has disapproved your vacation request for ${numberOfDays}
            days.
            Reason: ${managerMotivation}
         </documentation>
         <extensionElements>
            <activiti:formProperty id="numberOfDays" name="Number of days"
               value="${numberOfDays}" type="long" required="true" />
            <activiti:formProperty id="startDate"
               name="First day of holiday (dd-MM-yyy)" value="${startDate}"
               datePattern="dd-MM-yyyy hh:mm" type="date" required="true" />
            <activiti:formProperty id="vacationMotivation"
               name="Motivation" value="${vacationMotivation}" type="string" />
            <activiti:formProperty id="resendRequest"
               name="Resend vacation request to manager?" type="enum" required="true">
               <activiti:value id="true" name="Yes" />
               <activiti:value id="false" name="No" />
            </activiti:formProperty>
         </extensionElements>
         <humanPerformer>
            <resourceAssignmentExpression>
               <formalExpression>${employeeName}</formalExpression>
            </resourceAssignmentExpression>
         </humanPerformer>
      </userTask>
      <sequenceFlow id="flow6" sourceRef="adjustVacationRequestTask"
         targetRef="resendRequestDecision" />

      <exclusiveGateway id="resendRequestDecision" name="Resend request?" />
      <sequenceFlow id="flow7" sourceRef="resendRequestDecision"
         targetRef="handleRequest">
         <conditionExpression xsi:type="tFormalExpression">${resendRequest ==
            'true'}</conditionExpression>
      </sequenceFlow>

      <sequenceFlow id="flow8" sourceRef="resendRequestDecision"
         targetRef="theEnd2">
         <conditionExpression xsi:type="tFormalExpression">${resendRequest ==
            'false'}</conditionExpression>
      </sequenceFlow>
      <endEvent id="theEnd2" />

   </process>

</definitions>


Next I would like to do deploy:


   RepositoryService repositoryService = processEngine.getRepositoryService();
      repositoryService.createDeployment().addClasspathResource(fileName).deploy();
      System.out.println("Number of process definitions: " + repositoryService.createProcessDefinitionQuery().count());



During the upload I get the Exception:


Request processing failed; nested exception is org.activiti.engine.ActivitiIllegalArgumentException: resource 'D:\workspaceJava\workflow\workflow-engine\src\resources\process\VacationRequest.bpmn.xml' not found] with root cause
org.activiti.engine.ActivitiIllegalArgumentException: resource 'D:\workspaceJava\workflow\workflow-engine\src\resources\process\VacationRequest.bpmn.xml' not found
   at org.activiti.engine.impl.repository.DeploymentBuilderImpl.addClasspathResource(DeploymentBuilderImpl.java:67)
   at org.workflow.engine.service.VacationManagment.deploy(VacationManagment.java:47)
   at org.workflow.web.BaseController.welcome(BaseController.java:27)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:606)
   at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)
   at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:436)
   at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:424)
   at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:900)
   at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:827)
   at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
   at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
   at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
   at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:409)
   at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1044)
   at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
   at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:313)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
   at java.lang.Thread.run(Thread.java:744)


I run it with spring as web application on tomcat  7. The path to the file is correct becouse when I check it as

      InputStream input = null;
      try {
         input = new FileInputStream(fileName);
      } catch (FileNotFoundException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
      }
      if(input== null){
         System.out.println("Can't find resurce");
      }
else{
         System.out.println("find resurce");
      }

Outcomes