cancel
Showing results for 
Search instead for 
Did you mean: 

Source not found while deploy process

simonetogno
Champ in-the-making
Champ in-the-making
Hi this is my simple code



public void init(ServletConfig config) throws ServletException {
super.init(config);
processEngine = ProcessEngines.getDefaultProcessEngine();
}


protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    PrintWriter out = response.getWriter();

    RepositoryService repositoryService = processEngine.getRepositoryService();
    RuntimeService runtimeService = processEngine.getRuntimeService();

    Deployment deployment = repositoryService.createDeployment().addClasspathResource("C:/Users/Simone/workspace/ProvaNewDesigner/target/classes/diagrams/bpmn2_diagram.bpmn20.xml").deploy();

    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("helloworld");

    out.println("Started Process instance id " +processInstance.getProcessInstanceId());

}

when program perform this operation

Deployment deployment = repositoryService.createDeployment().addClasspathResource("C:/Users/Simone/workspace/ProvaNewDesigner/target/classes/diagrams/bpmn2_diagram.bpmn20.xml").deploy();

I' get the follow exception


GRAVE: Servlet.service() for servlet [ThisService] in context with path [/SimpleTry] threw exception
org.activiti.engine.ActivitiException: resource "C:/Users/Simone/workspace/ProvaNewDesigner/target/classes/diagrams/bpmn2_diagram.bpmn20.xml" not found
   at org.activiti.engine.impl.repository.DeploymentBuilderImpl.addClasspathResource(DeploymentBuilderImpl.java:58)
   at ThisService.doGet(ThisService.java:45)


26-mag-2011 15.15.38 org.activiti.engine.impl.ProcessEngineImpl <init>
INFO: ProcessEngine default created
26-mag-2011 15.15.38 org.activiti.engine.ProcessEngines initProcessEnginFromResource
INFO: initialised process engine default
26-mag-2011 15.15.38 org.activiti.engine.impl.jobexecutor.JobAcquisitionThread run
INFO: JobAcquisitionThread starting to acquire jobs
This is the operation that it can perform
(i don't now if it can be helpful)


excluding the path is uncorrect, what can be the reason of this exception?

Best regards
1 REPLY 1

frederikherema1
Star Contributor
Star Contributor
The method clearly says "addClasspathResource", this expects a path relative to the classPath. If you want to add a resource for which you know the absolute location, use:

deploymentBuilder.addInputStream("bpmn2_diagram.bpmn20.xml", new FileInputStream("C:/…."));