Spring get started app in a shared process engine

Hello!
Please help me in running simple example application on a shared process engine.
I downloaded camunda 7.9 tomcat distribution (camunda-bpm-tomcat-7.9.0.zip) and started it successfully. Then I built and deployed example spring application as stated in https://docs.camunda.org/get-started/spring/project-setup/.
Then I tried to modify app so it was running in a shared process engine (following this example https://docs.camunda.org/get-started/spring/shared-process-engine/), but it does not start after deploy.
The error is:
SEVERE [main] org.springframework.web.context.ContextLoader.initWebApplicationContext Context initialization failed
java.lang.RuntimeException: org.camunda.bpm.engine.ProcessEngineException: ENGINE-08043 Exception while performing ‘Deployment of Process Application processAp
plication’ => 'Deployment of process archive ‘loan-approval’: null

Hi Roman,

Could you please share your spring project.

Best regards,
Yana

1 Like

Hello Yana!
I have changed a single line to “false” in camunda-get-started-spring-Step-3\src\main\resources\META-INF\processes.xml:
false

Now the app is deployed and started successfully, but service task does not exec:
"Cannot instantiate process definition loanApproval:1:c0f782cb-30bc-11e6-ba7b-50465d7049f3: Unknown property used in expression
I have found that I need to manually register process application if there are no process definitions in a war file (I deployed process definition via REST api). Is it correct?
Thank you for your help

Hi Roman,

I am sorry but I couldn’t understand.
You don’t have process definitions in the war file? and you deploy via Rest API?
Could you please explain in more details.

Best regards,
Yana

Hi Yana!
Yes, I don’t have process definitions in a war file, but I deployed it successfully via REST earlier with the following command:
curl -v -w “\n” -H “Accept: application/json” -F “deployment-name=approve1” -F “enable-duplicate-filtering=false” -F “deploy-changed-only=false” -F file=@approve1.bpmn %API%/engine/default/deployment/create

and the error was raising until I changed value of isScanForProcessDefinitions property to false in processes.xml.
If I understand it correctly now I need to somehow register my newly deployed process application (war file) with uploaded earlier process definition.

Why do you want to do that?
I am sorry, I don’t see what is your use case.

Yana, thank you for trying to help. I will try to explain in details.
I have a simple bpmn diagram uploaded, where in service task (TestService2) I call java delegate:



Then I go to Camunda TaskList, click on “Start process” and get error:


image

It looks like Camunda cannot find java delegate in my deployed war, though it is deployed and started in tomcat.

Hi Roman,

Thanks for the explanation. I hope I got it this time.
That’s the reason I ask you why do you want to deploy the war file separately from the process definition.
You need to deploy the process and related java classes together in one war file and these kind of errors won’t appear. And it seems to me that is the problem in your case.
You should not mix the ways of deployment strategies.
As it is shown in Using Shared Process Engine [1] you project should contain the java logic together with the process under /src/main/resources.
If you download the Source Bonus Code from the bottom of the page [1], you will see that the loanApproval process example is part of the project.

P.S.I think that this post will help you to understand better [2], Niall explained similar scenario. Even that the problem there is that is mixed Rest and war deployment, the point is still the same you should deploy in consistent way.

[1] https://docs.camunda.org/get-started/spring/shared-process-engine/
[2] Exception while starting a new bpmn process instance

Best regards,
Yana

1 Like

Yana, thank you!
But then I do not understand the idea of Camunda BPM… I thought that developer could write code once with many different services and deploy it, then publish API docs to users and forget about it completely. And users, in turn, could further develop different BPMN models and publish them independently from java code.
But if BPMN models must lay inside the war, then every change in model will force us to redeploy the war, break current running sessions, loose model versioning…

There are various approaches:

  1. Deployments via REST go well together with external tasks and external task workers. With this approach, process and service task implementation are loosely coupled. This sounds like what you are looking for.
  2. Deployments via process applications go well together with JavaDelegate implementations. With this approach, process and service task implementation are tightly coupled, which is why it makes sense to keep them in a single WAR artifact.

You can mix the approaches, but then you have to know quite well how Camunda works.

1 Like

Thank you for help. I thought about REST and external tasks, but what I do not like in this approach is the need of authentication in Camunda.
Suppose we have a custom WEB application, where users need to authenticate themselves. Then, in web app in order to get external tasks list assigned to current logged in user, web app need to send auth request to camunda first. Where in web app to keep this auth info, how to sync session expiration time…?