Engine-rest REST call doesn't know about non-default engine

Hi,

I have a tomcat deployment, where I have:

  • tomcat/webapps/engine-rest
  • tomcat/webapps/app-1
  • tomcat/webapps/app-2

I use spring configuration to create my processEngineConfiguration in tomcat/webapps/app-1/WEB-INF/applicationContext.xml like so:

	<bean id="processEngineConfiguration"
		  class="org.camunda.bpm.engine.spring.SpringProcessEngineConfiguration">
        <property name="processEngineName" value="default" />
        <property name="dataSource" ref="bpmDataSource" />
        <property name="transactionManager" ref="transactionManager" />
        <property name="databaseSchemaUpdate" value="true" />
        <property name="jobExecutorActivate" value="false" />
        <property name="history" value="full" />
        <property name="authorizationEnabled" value="true" />
        <property name="jobExecutorDeploymentAware" value="true" />
        <property name="jdbcBatchProcessing" value="false" />
        <property name="idGenerator">
            <bean class="org.camunda.bpm.engine.impl.persistence.StrongUuidGenerator" />
        </property>

        <property name="processEnginePlugins">
            <list>
                <bean id="procAppEventListenerPlugin" class="org.camunda.bpm.application.impl.event.ProcessApplicationEventListenerPlugin" />
            </list>
        </property>

    </bean>

    <!-- using ManagedProcessEngineFactoryBean allows registering the ProcessEngine with the BpmPlatform -->
    <bean id="processEngine2" class="org.camunda.bpm.engine.spring.container.ManagedProcessEngineFactoryBean">
        <property name="processEngineConfiguration" ref="processEngineConfiguration"/>
    </bean>

And I have another similar setup as above, for tomcat/webapps/app-2, but for app-2, I have

`<property name="processEngineName" value="default2" />`

(instead of “default”).

When running REST API operations with the webapps/engine-rest endpoint, it only knows about “default”, and not “default2”.

When explicitly trying the engine/rest API specifying an engine in the URL like

`engine/default2/...`

I get:

"{"type":"InvalidRequestException","message":"No process engine available"}"

So my question is, how can I get the engine/rest endpoint to do operations on “default2”?

My understanding was that ManagedProcessEngineFactoryBean would register it to bpm-platform, and hence make it available to engine-rest. Is this assumption incorrect?

Also, as a secondary question: I had almost this exact post created a few days ago:
https://forum.camunda.io/t/engine-rest-rest-endpoint-not-finding-non-default-engine/25438
but now it’s completely gone/missing? I noticed that around the same time, the login page slightly changed, so perhaps some sort of forum maintenance activity deleted my original post? Or maybe I somehow accidentally deleted it :slight_smile:

Thanks,
Galen

Here’s some more background that will help show the motivations behind the setup.

app-1 is a web UI app that can:

  • deploy process definitions
  • does NOT directly run jobs (jobExecutorActivate = false)

app-2 is a worker app that:

  • does NOT deploy process definitions
  • run jobs (jobExecutorActivate = true)

It seems I cannot set processEngineName to “default” for both app-1 and app-2, and that’s why I had to use “default2” for app-2.

Hope that makes sense.

Thank you,
Galen

Hello Galen,
A few questions:

  1. Are you using exclusively xml to configure your spring environment? Do you also have code using Spring Java bean config?
  2. If you have two separate apps, why are you defining both engines in one application context?
  3. Can you explain why you can’t have two separate applications?

Thank you,
Emma

Hello again Galen,

Are you using Tomcat 7?
If you are using tomcat 7, you will need to do the following to use the JNDI bindings.
I believe this could be your issue.

https://docs.camunda.org/manual/7.13/user-guide/runtime-container-integration/tomcat/

Can you try this and then see if the issue persists?

Thank you,
Emma

Assuming you want default engine to handle job execution and backup engine to handle REST requests.

I have created a quick example with Docker and Tomcat configuring two engines in a tomcat container.


Environment


TIP: To try this download the bpm-platform.xml (1.4 KB) and run the following command.

docker run -d --name camunda -p 8080:8080 -v $PWD/bpm-platform.xml:/camunda/conf/bpm-platform.xml camunda/camunda-bpm-platform:latest 


See in the logs. Only one active job executor. The backup engine has no active job executor.

docker logs camunda --follow


Access the web-apps with separate engines

http://localhost:8080/camunda/app/cockpit/backup/#/dashboard
http://localhost:8080/camunda/app/cockpit/default/#/dashboard


Access the engines with separate rest endpoints

http://localhost:8080/engine-rest/engine/backup/process-definition/
http://localhost:8080/engine-rest/engine/default/process-definition/


Example bpm-platform.xml (1.4 KB)

  • Configure two engines.
  • Turn off one the job-executors with the property jobExecutorActivate.
<?xml version="1.0" encoding="UTF-8"?>
<bpm-platform xmlns="http://www.camunda.org/schema/1.0/BpmPlatform"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://www.camunda.org/schema/1.0/BpmPlatform http://www.camunda.org/schema/1.0/BpmPlatform">

  <job-executor>
    <job-acquisition name="default" />
    <job-acquisition name="backup" />
  </job-executor>

  <process-engine name="default">
   <job-acquisition>default</job-acquisition>
    <configuration>org.camunda.bpm.engine.impl.cfg.StandaloneProcessEngineConfiguration</configuration>
    <datasource>java:jdbc/ProcessEngine</datasource>    <properties>
      <property name="history">full</property>
      <property name="databaseSchemaUpdate">true</property>
      <property name="authorizationEnabled">true</property>
    </properties>
  </process-engine>


   <process-engine name="backup">
    <job-acquisition>backup</job-acquisition>
    <configuration>org.camunda.bpm.engine.impl.cfg.StandaloneProcessEngineConfiguration</configuration>
    <datasource>java:jdbc/ProcessEngine</datasource>
    <properties>
      <property name="history">full</property>
      <property name="databaseSchemaUpdate">true</property>
      <property name="authorizationEnabled">true</property>
      <property name="jobExecutorActivate">false</property>
    </properties>
  </process-engine>

</bpm-platform>

More info