startProcessInstanceByKey can't find process key

Hello!

I’m trying to get into Camunda, and learn more about it. I was following the tutorial on https://github.com/camunda/camunda-bpm-examples/tree/master/servicetask/rest-service

I’ve stumbled upon a problem that I just can’t seem to figure out.
I’ve tried just following the code and just downloading it directly.

I always get this error:

shouldPackForWork(org.camunda.bpm.example.servicetask.rest.ServiceTaskRestTest): no processes deployed with key 'holiday': processDefinition is null
  shouldPackForHoliday(org.camunda.bpm.example.servicetask.rest.ServiceTaskRestTest): no processes deployed with key 'holiday': processDefinition is null

Here are the full logs:
org.camunda.bpm.example.servicetask.rest.ServiceTaskRestTest.txt (11.1 KB)

I’ve searched through previous posts and most were solved because people were introducing the wrong id, and I’m pretty sure that’s not the problem here.

I’ve checked the process id, I’ve gone to Postman. The id there is “holiday”. The deployment appears on cockpit.

One curious thing that I found through testing (not sure this is relevant) was that even when I used the id for a different process (as it showed me in Postman) it always gives me the error that the key is not found.

I’m guessing the problem is that somehow I’m not connecting properly to the key list or however it’s stored.

Can you upload the model as well?

I’m using the git’s model, but here you go

invokeRestService.bpmn (7.4 KB)

I remade everything and I think it’s working (no errors).

But I have a question. After I run the unit test what’s supposed to happen? How can I check what happened in that specific test, like, which branch did it go through?

There’s a really great community extension available that does that. you can check it out here:

I’m having some problems using that extension.

It’s stated that it only needs 3 steps, I’m stuck on the last one.
I’m supposed to replace this:

@Rule
public ProcessEngineRule processEngineRule = new ProcessEngineRule();

With this:

@Rule
  @ClassRule
  public static ProcessEngineRule rule = TestCoverageProcessEngineRuleBuilder.create().build();

Correct?
Eclipse gives me several errors, like “ClassRule cannot be resolved to a type”, as well as “TestCoverageProcessEngineRuleBuilder cannot be resolved”.
I’ve added the dependencies in pom.xml and I’ve changed the ProcessEngineConfiguration in camunda.cfg.xml as well.
What am I missing here?

Hi @r0drigor,

that should be everything you have to do.

Perhaps it’s an Eclipse-Maven-Issue. Try Maven -> Update Project (or Alt+F5) on your project.

Hope this helps, Ingo

I’ve tried that as well.

These are the error logs:

[ERROR] /C:/Users/rodriguesr/eclipse-workspace/holiday-service/src/test/java/org/camunda/bpm/example/servicetask/rest/ServiceTaskRestTest.java:[41,10] cannot find symbol
  symbol:   class ClassRule
  location: class org.camunda.bpm.example.servicetask.rest.ServiceTaskRestTest
[ERROR] /C:/Users/rodriguesr/eclipse-workspace/holiday-service/src/test/java/org/camunda/bpm/example/servicetask/rest/ServiceTaskRestTest.java:[42,48] cannot find symbol
  symbol:   variable TestCoverageProcessEngineRuleBuilder
  location: class org.camunda.bpm.example.servicetask.rest.ServiceTaskRestTest
[ERROR] /C:/Users/rodriguesr/eclipse-workspace/holiday-service/src/test/java/org/camunda/bpm/example/servicetask/rest/ServiceTaskRestTest.java:[50,37] cannot find symbol
  symbol:   variable processEngineRule
  location: class org.camunda.bpm.example.servicetask.rest.ServiceTaskRestTest
[ERROR] /C:/Users/rodriguesr/eclipse-workspace/holiday-service/src/test/java/org/camunda/bpm/example/servicetask/rest/ServiceTaskRestTest.java:[51,31] cannot find symbol
  symbol:   variable processEngineRule
  location: class org.camunda.bpm.example.servicetask.rest.ServiceTaskRestTest
[ERROR] /C:/Users/rodriguesr/eclipse-workspace/holiday-service/src/test/java/org/camunda/bpm/example/servicetask/rest/ServiceTaskRestTest.java:[69,37] cannot find symbol
  symbol:   variable processEngineRule
  location: class org.camunda.bpm.example.servicetask.rest.ServiceTaskRestTest
[ERROR] /C:/Users/rodriguesr/eclipse-workspace/holiday-service/src/test/java/org/camunda/bpm/example/servicetask/rest/ServiceTaskRestTest.java:[70,31] cannot find symbol
  symbol:   variable processEngineRule
  location: class org.camunda.bpm.example.servicetask.rest.ServiceTaskRestTest
[INFO] 6 errors 

Is there anything else I can send you that may be helpful in solving this problem?

Hi @r0drigor,

usually it’s a local problem on your computer.

Try to run it from the command line: mvn clean test.

Maybe some libraries are corrupted from the maven download. Then you can delete them from your local repository and trigger a new download.

Hope this helps, Ingo

Hello @Ingo_Richtsmeier,

Apparently I didn’t have mvn installed.
I installed it, set the PATH and everything seemed to be working correctly.
I tried doing mvn clean test but the same problem arose.

I also tried, as you stated, deleting the local repository with: mvn dependency:purge-local-repository
Still, no luck. The same errors appear.
Any more ideas?