cancel
Showing results for 
Search instead for 
Did you mean: 

VacationRequest.bpmn20.xml' not found

ericsnyder
Champ on-the-rise
Champ on-the-rise
I am working through the user guide and have run into an issue. this is most likely from my lack of Java knowledge. I created the file src/test/resources/org/activiti/test/VacationRequest.bpmn20.xml as instructed in the user guide and have the following code:


   public static void main(String[] args) {
      System.out.println("Starting Process Engine");
      org.activiti.engine.ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
      
      RuntimeService runtimeService = processEngine.getRuntimeService();
      RepositoryService repositoryService = processEngine.getRepositoryService();
      TaskService taskService = processEngine.getTaskService();
      ManagementService managementService = processEngine.getManagementService();
      IdentityService identityService = processEngine.getIdentityService();
      HistoryService historyService = processEngine.getHistoryService();
      FormService formService = processEngine.getFormService();

      try {
         repositoryService.createDeployment()
           .addClasspathResource("src/test/resources/org/activiti/test/VacationRequest.bpmn20.xml")
           .deploy();
      } catch (Exception e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
      }
           

      try {
          Thread.sleep(10000);
      } catch(InterruptedException ex) {
          Thread.currentThread().interrupt();
      }
      System.out.println("Closing Process Engine");
      processEngine.close();
      System.out.println("Closed Process Engine");
   }

I get the following Exception:
org.activiti.engine.ActivitiException: resource 'src/test/resources/org/activiti/test/VacationRequest.bpmn20.xml' not found
   at org.activiti.engine.impl.repository.DeploymentBuilderImpl.addClasspathResource(DeploymentBuilderImpl.java:62)
   at ProcessEngine.main(ProcessEngine.java:23)

I am guessing that I do not have something set properly in the project. I checked "Project > Properties > Resource" and my settings are:

Path: /ActivitiServer
Type: Project
Location: C:\Documents and Settings\Eric\My Documents\Eclipse\workspaces\Eclipse IDE for Java EE Developers 422\ActivitiServer

I even tried :
         repositoryService.createDeployment()
           .addClasspathResource("C:/Documents and Settings/Eric/My Documents/Eclipse/workspaces/Eclipse IDE for Java EE Developers 422/ActivitiServer/src/test/resources/org/activiti/test/VacationRequest.bpmn20.xml")
           .deploy();

No Joy… Smiley Sad

What am I doing wrong?

EDIT: I am using Maven
4 REPLIES 4

jbarrez
Star Contributor
Star Contributor
If your bpmn file is in src/test/resources/org/activiti/test/VacationRequest.bpmn20.xml , then your class with the main() also needs to be in src/test/java or else the classpath won't be correct for your use case.

ericsnyder
Champ on-the-rise
Champ on-the-rise
jbarrez, thanks for the prompt reply and help.

So…either move the class file to be in the same folder as the VacationRequest.bpmn20.xml file (makes no sense in this case) or move the VacationRequest.bpmn20.xml to be in the same folder as the class with the main?

Can you point me to info/tutorial where I can learn and understand about this so I don't bug people with noob questions like this?  Smiley Wink  I mean, is this an eclipse thing or a java thing? Java is more vast than any language I have learned before. Sometimes it's hard to find what you need if you don't exactly know what you need if you catch my drift.  Smiley Surprisedops:

jbarrez
Star Contributor
Star Contributor
It's actually Maven who's handling the classpath for you in this case 🙂

It's pretty easy:
main/src/java -> all your classes for your application
main/src/resources -> all your resources for your application (eg activiti config)

This is the classpath as how it would run in a typical Java web application

test/src/java -> unit tests
test/src/resources -> unit test resources

–> This is the test classpath. The test classpath is this + the main classpath above.
So hence my suggestion of putting your bpmn file in the resources folder which matches where your java files are placed.

ericsnyder
Champ on-the-rise
Champ on-the-rise
Very helpful, the right tip to get me going.

I also found this post about how the resource file path gets tweaked a bit.