We run Camunda (latest version) in a multi tenancy environment, we don’t use the Camunda Spring boot, but have created our own Spring boot as Camunda Spring boot does not support multi tenancy.
However, we noticed that we get the following error when using the @DirtiesContext annotation on camunda tests:
Caused by: org.camunda.bpm.engine.ProcessEngineException: Cannot register service org.camunda.bpm.platform.job-executor.process-application:type=CWF Camunda Process Application with MBeans Container, service with same name already registered.
Any idea how to solve that? It seems that on Spring context refresh, the Camunda application, which is a child class of SpringProcessApplication, is not correctly removed/undeployed, such that when the Spring Context is created, the Camunda application is still present in the MBeanServer, such that Camunda throws an exception.
How to solve this? How to ensure that the Camunda application is correctly removed during a Spring Context refresh during tests?
(The error only occurs when running all tests, when the failing test is run alone, is runs with success)