Shared process engine - war deployment of a process

I set up the Camunda BPM platform and ran the start-camunda.sh. With this configuration, I can build, package and deploy a separate .war file containing a process that has Java and bpmn files and it will be recognized.

I am now trying to do something similar except using an embedded Camunda process bootstrapped via Spring Boot and then deployed to a Tomcat server. If I deploy the same .war file as described above, it does not deploy into the Camunda process engine as it did with the out-of-the-box installation. I have tried the instructions here, but it didn’t seem to help https://docs.camunda.org/get-started/spring/shared-process-engine/

What am I missing?

Hi @scrounger,

If you want to use Spring Boot you can check its get-started guide.
And if you still have problem could you please share the application conf file and your latest server log file.

Best regards,
Yana

I am no longer using Spring boot and have started over by following the tutorial for Spring at https://docs.camunda.org/get-started/spring/ (first 3 sections). The tutorial works as expected.

Now I want to split the war into 2 separate wars. The first war is to be the shared process engine while the second is to be just the LoanApplication process to be deployed independently on the same Tomcat server.

I can deploy and run the first war (the shared process engine) and verify it is running. However the second war (the LoanApplication process) is not recognized when I deploy it. I’m obviously missing some key step.

Here is the camunda config in the first war’s pom (the shared process engine):

    <dependency>
        <groupId>org.camunda.bpm</groupId>
        <artifactId>camunda-engine</artifactId>
    </dependency>
    <dependency>
        <groupId>org.camunda.bpm</groupId>
        <artifactId>camunda-engine-spring</artifactId>
    </dependency>

And the Spring context:

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
                         http://www.springframework.org/schema/beans/spring-beans.xsd
                         http://www.springframework.org/schema/context
                         http://www.springframework.org/schema/context/spring-context-2.5.xsd" >

    <bean id="dataSource" class="org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy">
        <property name="targetDataSource">
            <bean class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
                <property name="driverClass" value="org.h2.Driver" />
                <property name="url"
                          value="jdbc:h2:mem:process-engine;DB_CLOSE_DELAY=1000" />
                <property name="username" value="sa" />
                <property name="password" value="" />
            </bean>
        </property>
    </bean>

    <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
        <property name="dataSource" ref="dataSource" />
    </bean>

    <bean id="processEngineConfiguration" class="org.camunda.bpm.engine.spring.SpringProcessEngineConfiguration">
        <property name="processEngineName" value="engine" />
        <property name="dataSource" ref="dataSource" />
        <property name="transactionManager" ref="transactionManager" />
        <property name="databaseSchemaUpdate" value="true" />
        <property name="jobExecutorActivate" value="false" />
        <property name="deploymentResources" value="classpath*:*.bpmn" />
    </bean>

    <bean id="processEngine" class="org.camunda.bpm.engine.spring.ProcessEngineFactoryBean">
        <property name="processEngineConfiguration" ref="processEngineConfiguration" />
    </bean>

    <bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService" />
    <bean id="runtimeService" factory-bean="processEngine" factory-method="getRuntimeService" />
    <bean id="taskService" factory-bean="processEngine" factory-method="getTaskService" />
    <bean id="historyService" factory-bean="processEngine" factory-method="getHistoryService" />
    <bean id="managementService" factory-bean="processEngine" factory-method="getManagementService" />

    <context:annotation-config />

</beans>

The second war (LoanApproval) was initially built using the camunda-archetype=servlet-war and contains the LoanApproval.bpmn and CalculateInterestService (both from the tutorial) as wall as this processes.xml:

<?xml version="1.0" encoding="UTF-8"?>
<process-application
  xmlns="http://www.camunda.org/schema/1.0/ProcessApplication"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <process-archive>
    <process-engine>default</process-engine>
    <properties>
      <property name="isDeleteUponUndeploy">false</property>
      <property name="isScanForProcessDefinitions">true</property>
    </properties>
  </process-archive>

</process-application>

And this is the camunda reference in the LoanApproval war’s pom.xml:

<dependency>
  <!-- process engine, needs to be provided -->
  <groupId>org.camunda.bpm</groupId>
  <artifactId>camunda-engine</artifactId>
  <scope>provided</scope>
</dependency>

The Tomcat server log does not indicate any errors with either of the war deployments.

In my shared process server (the first war), I have defined this rest api to get process definitions, none are found after deploying the LoanApplication process’ war.

package com.vi.intel.smartserver;

import com.google.gson.Gson;
import org.camunda.bpm.engine.ProcessEngine;
import org.camunda.bpm.engine.RepositoryService;
import org.camunda.bpm.engine.repository.ProcessDefinition;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class RestApi {

    @Autowired
    private ProcessEngine processEngine;

    private Gson gson = new Gson();

    @RequestMapping(value = "/api/processDefs", method = RequestMethod.GET)
    @ResponseBody
    public String processDefs() {
        RepositoryService processEngineServices = processEngine.getRepositoryService();

        // query for latest process definition with given name
        List<ProcessDefinition> processDefinitions =
                processEngineServices.createProcessDefinitionQuery().list();
        return gson.toJson(processDefinitions);
    }

}

Hello scrounger,
Are you able to resolved the above query?

I found the solution Camunda Spring Boot with Shared Engine with War file