Got a null pointer exception when building the engine


We just migrated from Activiti 5.x to Camunda 7.6.0 successfully. Now, we are trying to move to a bigger version and everything goes smoothly 'til version 7.11.0. Trying to move to 7.12.0 causes an exception. A process that was running ok, throws now a NullPointerException in line 47 of SpringBeansResolverFactory:

String[] beannames = applicationContext.getBeanDefinitionNames();

The error clearly shows that for some reason applicationContext is null.

By debugging we found that this code is called when initScripting() is being executed.

Here, an excerpt of the actual stack trace:

Caused by: java.lang.NullPointerException: null
	at org.camunda.bpm.engine.spring.SpringBeansResolverFactory.<init>(
	at org.camunda.bpm.engine.spring.SpringProcessEngineConfiguration.initScripting(
	at org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl.init(
	at org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl.buildProcessEngine(
	at org.camunda.bpm.engine.spring.SpringTransactionsProcessEngineConfiguration.buildProcessEngine(

Our project uses Spring Boot 2.2.0 and runs against a Postgres DB. In this particular issue we can see that the db has not been touched yet for it is happening at the very early stages of the engine initiation.


Have you checked out the compatibility matrix to ensure that you’re using the right spring boot version with the the right engine version.

Yes. Actually we saw in the documentation for migration that checking that compatibility is a requirement when using Camunda Spring Starter. Even if we are not using it, we made sure we are using Spring Boot 2.2.0, which is the requirement in the matrix. Thanks.

I decided to create a simple project to illustrate the issue. You may clone

And run

./gradlew test

Everything should be ok and the one single test in the project should pass.

Then, if you go to build.gradle and change the version of Camunda from 7.11 to 7.12 and try again the test, you will get the error cause by the NullPointerException already described.

The project is a simple Java project that intends to be a library that uses a Camunda engine. The one single test just tries to inject the engine service and verifies it is available (not null):

@ContextConfiguration(classes = TestConfiguration.class)
public class TestEngineService {

	private EngineService engineService;

	public final void testThatEngineServiceIsAvailable() {

EngineService is defined using a simple Spring service like this:

public class EngineService {

	public EngineService(ProcessEngineFactoryBean processEngineFactoryBean) {

And the process engine configuration is pretty much the one written in all documentation and getting started manuals from Camunda:

public class EngineConfiguration {

	private DataSource dataSource() {

		SimpleDriverDataSource dataSource = new SimpleDriverDataSource();


		return dataSource;

	private DataSourceTransactionManager transactionManager() {

		return new DataSourceTransactionManager(dataSource());

	private SpringProcessEngineConfiguration processEngineConfiguration() {

		SpringProcessEngineConfiguration config = new SpringProcessEngineConfiguration();



		return config;

	public ProcessEngineFactoryBean processEngineFactoryBean() {

		ProcessEngineFactoryBean factoryBean = new ProcessEngineFactoryBean();
		return factoryBean;


This is the original build.gradle file, before switching to 7.12:

plugins {
	id 'java'
	id "io.spring.dependency-management" version "1.0.9.RELEASE"

sourceCompatibility = '1.8'

ext {
	camunda_version = '7.11.0'
	spring_version = '5.2.11.RELEASE'

dependencyManagement {
	imports {
			mavenBom "org.camunda.bpm:camunda-bom:${camunda_version}"
			mavenBom "org.springframework:spring-framework-bom:${spring_version}"
dependencies {

	repositories {
	compile (group: 'org.camunda.bpm', name: 'camunda-engine')
	compile (group: 'org.camunda.bpm', name: 'camunda-engine-spring')

	compile (group: 'org.springframework', name: 'spring-context')
	compile (group: 'org.springframework', name: 'spring-jdbc')
	compile (group: 'org.springframework', name: 'spring-tx')
	compile (group: 'org.springframework', name: 'spring-orm')

	compile (group: 'com.h2database', name: 'h2', version: '1.4.196')
	testCompile (group: 'junit', name: 'junit', version: '4.12')
	testCompile (group: 'org.springframework', name: 'spring-test')


Any help for troubleshooting this issue will be much appreciated.


1 Like