Error when using processApplication

I have a very minimal example consisting of a resources/diagram.bpmn, an empty resources/META-INF/process.xml and the following code:

private static ProcessEngineConfiguration configuration = new StandaloneInMemProcessEngineConfiguration(){{
  expressionManager = new MockExpressionManager();
  jobExecutorActivate = false;
}};

@ProcessApplication
public static class MyProcessApplication extends EmbeddedProcessApplication {

}

public static void main(String... args) {
  ProcessApplicationInterface processApplication = null;
  try {
    ProcessEngine processEngine = configuration.buildProcessEngine();
    ProcessEngines.registerProcessEngine(processEngine);

    processApplication = new MyProcessApplication();
    processApplication.deploy();
  } finally {
    processApplication.undeploy();
  }

}

However, when I run it, I am getting an exception:

Exception in thread "main" org.camunda.bpm.engine.ProcessEngineException: ENGINE-08043 Exception while performing 'Deployment of Process Application Process Application' => 'Deployment of process archive 'null': Cannot deploy process archive 'null' to default process: no such process engine exists: processEngine is null
    at org.camunda.bpm.container.impl.ContainerIntegrationLogger.exceptionWhilePerformingOperationStep(ContainerIntegrationLogger.java:312)
    at org.camunda.bpm.container.impl.spi.DeploymentOperation.execute(DeploymentOperation.java:130)
    at org.camunda.bpm.container.impl.jmx.MBeanServiceContainer.executeDeploymentOperation(MBeanServiceContainer.java:156)
    at org.camunda.bpm.container.impl.spi.DeploymentOperation$DeploymentOperationBuilder.execute(DeploymentOperation.java:203)
    at org.camunda.bpm.container.impl.RuntimeContainerDelegateImpl.deployProcessApplication(RuntimeContainerDelegateImpl.java:88)
    at org.camunda.bpm.application.AbstractProcessApplication.deploy(AbstractProcessApplication.java:58)
    at de.holisticon.bpm.camunda.ProcessApplicationTest.main(ProcessApplicationTest.java:31)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Caused by: org.camunda.bpm.engine.exception.NullValueException: Cannot deploy process archive 'null' to default process: no such process engine exists: processEngine is null
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
    at org.camunda.bpm.engine.impl.util.EnsureUtil.generateException(EnsureUtil.java:329)
    at org.camunda.bpm.engine.impl.util.EnsureUtil.ensureNotNull(EnsureUtil.java:49)
    at org.camunda.bpm.engine.impl.util.EnsureUtil.ensureNotNull(EnsureUtil.java:44)
    at org.camunda.bpm.container.impl.deployment.DeployProcessArchiveStep.getProcessEngine(DeployProcessArchiveStep.java:204)
    at org.camunda.bpm.container.impl.deployment.DeployProcessArchiveStep.performOperationStep(DeployProcessArchiveStep.java:75)
    at org.camunda.bpm.container.impl.spi.DeploymentOperation.execute(DeploymentOperation.java:114)
    ... 10 more

any idea why?

1 Like

Hi Jan,

use the following code to register the process engine.

RuntimeContainerDelegate runtimeContainerDelegate = RuntimeContainerDelegate.INSTANCE.get();
runtimeContainerDelegate.registerProcessEngine(processEngine);

ProcessEngines.registerProcessEngine is not the correct method to register the process engine. Above method will do additional stuff.
See EmbeddedProcessApplicationTest

Cheers,
Christian

1 Like

Thanks … that solved it.

When do I use the ProcessEngines.register(…) method? To I register on both, Engines and ContainerDelegate, or just ContainerDelegate?

Other point, (slightly offtopic): Is there a way to replace the default ContainerDelegate with a custom container delegate? I do not want an empty processes.xml “parsed”, I want to set application.properties directly …