Incorrect Spring Setup?


#1

Hi,

I have a setup where I have a Spring application context which specifies a processEngine, and creates the runtimeService, among other services like this:

<!-- bind the process engine service as Spring Bean -->
<bean name="processEngineService" class="org.camunda.bpm.BpmPlatform" factory-method="getProcessEngineService" />

<!-- bind the default process engine as Spring Bean -->
<bean name="processEngine" factory-bean="processEngineService" factory-method="getDefaultProcessEngine" />

<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="externalTaskService" factory-bean="processEngine" factory-method="getExternalTaskService"/>
<bean id="historyService"      factory-bean="processEngine" factory-method="getHistoryService"/>
<bean id="identityService"     factory-bean="processEngine" factory-method="getIdentityService" />
<bean id="managementService"   factory-bean="processEngine" factory-method="getManagementService"/>

I also have a bpm-platform.xml file that specifies a processEngine:

<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>
...

Is this a conflicting setup, where I have the processEngine being used as the one defined in the bpm-platform.xml, and the runtimeService being based off of a completely different process engine?

Or does the getProcessEngineService factory-method get the configuration from my bpm-platform.xml?

Thanks!


#2

Process engine bootstrap configuration should be exists only one place. If you are using spring beans xml to configure process engine then bpmplatform xml not required


#3

Thanks!

I’ve removed my processes.xml file, and put the configuration in my Spring applicationContext.xml.

However, now it’s not invoking my @PostDeploy method anymore in my application:

@ProcessApplication
public class MyEngineProcessApplication extends SpringProcessApplication implements 
InitializingBean {
...
    	@PostDeploy
     	public void onDeploymentFinished(ProcessEngine processEngine) {
            ...
        }
 
       	@Override
        public void afterPropertiesSet() throws Exception {
            System.out.println("AFTER PROPS SET");
        }
}

Do you know why this isn’t being invoked anymore?
The bean is being created still, as I see the “AFTER PROPS SET” log.
The bean is defined in my spring applicationContext.xml.

Thanks,
Galen


#4

It seems as if bpm-platform.xml is still required:

12-Sep-2019 08:11:08.889 SEVERE [main] org.apache.catalina.startup.Catalina.start The required Server component failed to start so Tomcat is unable to start.
 org.apache.catalina.LifecycleException: Failed to start component [StandardServer[8005]]
        at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:441)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:682)
        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:498)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:350)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:492)
Caused by: org.camunda.bpm.engine.ProcessEngineException: ENGINE-08043 Exception while performing 'deploy BPM platform' => 'Parsing bpm-platform.xml file': Unable to find bpm-platform.xml. This file is necessary for deploying the camunda BPM platform: bpmPlatformXmlSource is null
        at org.camunda.bpm.container.impl.ContainerIntegrationLogger.exceptionWhilePerformingOperationStep(ContainerIntegrationLogger.java:315)

If I put in an empty bpm-platform.xml file, Camunda seems to auto-fill it out with default process engine…

So how do I do the pure spring deployment I desire? In the case where Camunda auto-populates the process engine in bpm-platform.xml, there is then a conflict (extra) process engine.

Thanks,
Galen


#5

To follow up on this. The only way I was able to get this setup to work, was if I keep bpm-platform.xml, but have it contain ONLY

<job-executor>
<job-acquisition name=“default”>

So only the “job-executor” definition.

I guess this works, but is still sort of a “hybrid” solution, where the job-executor is still not defined using Spring.

Thanks,
Galen