Activiti/Activiti · error · ActivitiException

no org.activiti.engine.ProcessEngine defined in the…

Error message

no org.activiti.engine.ProcessEngine defined in the application context ${resource}

What it means

SpringConfigurationHelper.buildProcessEngine() builds a Spring application context from an XML resource and expects exactly one ProcessEngine bean to be defined inside it. If no ProcessEngine beans are found (or the map is empty), it throws an ActivitiException stating that no org.activiti.engine.ProcessEngine is defined in that context. This is a configuration error for XML-based Spring process engine setups.

Solutions

  1. Add a ProcessEngine bean (org.activiti.spring.ProcessEngineFactoryBean with a SpringProcessEngineConfiguration) to the referenced XML context.
  2. Ensure the helper is pointed at the correct Spring XML resource containing the engine definition.
  3. Check the XML loads without errors — a failing bean definition can leave the context without the engine bean.
  4. Migrate to Spring Boot auto-configuration (activiti-spring-boot-starter) if XML configuration is no longer desired.

Example fix

// before (spring xml)
<bean id="dataSource" class="..."/>
// after (spring xml)
<bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
  <property name="dataSource" ref="dataSource"/>
  <property name="transactionManager" ref="transactionManager"/>
</bean>
<bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean">
  <property name="processEngineConfiguration" ref="processEngineConfiguration"/>
</bean>
Defensive patterns

Strategy: validation

Validate before calling

GenericXmlApplicationContext ctx = new GenericXmlApplicationContext(new UrlResource(xmlResource));
if (ctx.getBeansOfType(ProcessEngine.class).isEmpty()) {
    throw new IllegalStateException("XML context has no ProcessEngine bean: " + xmlResource);
}

Try / catch

try {
    ProcessEngine engine = SpringConfigurationHelper.buildProcessEngine(resource);
} catch (ActivitiException e) {
    throw new IllegalStateException("Check that " + resource + " defines a ProcessEngine bean", e);
}

Prevention

When it happens

Trigger: Calling buildProcessEngine with an XML resource whose context contains no bean of type ProcessEngine (e.g. the XML defines only a datasource, or the process-engine bean has a different type or failed to load).

Common situations: Spring XML config missing the ProcessEngineFactoryBean definition, bean defined with wrong id/type after refactoring, or pointing the helper at the wrong XML file (e.g. a plain applicationContext.xml without engine config).

Understand the failure class

Background: "X is required", "must be set", "cannot be empty": the missing-required-config error family, from Vertex AI project/location to WeChat keys — this error's family across 18 libraries.

Related errors


AI-assisted analysis of Activiti/Activiti@56435b1a97 (2026-09-09). Data as JSON: /api/errors/62af8b82d31bb07f. Report an issue: GitHub.

Appendix: source

Thrown at activiti-core/activiti-spring/src/main/java/org/activiti/spring/SpringConfigurationHelper.java:43

import org.springframework.context.support.GenericXmlApplicationContext;
import org.springframework.core.io.UrlResource;

/**

 */
public class SpringConfigurationHelper {

    private static Logger log = LoggerFactory.getLogger(SpringConfigurationHelper.class);

    public static ProcessEngine buildProcessEngine(URL resource) {
        log.debug(
            "==== BUILDING SPRING APPLICATION CONTEXT AND PROCESS ENGINE ========================================="
        );

        ApplicationContext applicationContext = new GenericXmlApplicationContext(new UrlResource(resource));
        Map<String, ProcessEngine> beansOfType = applicationContext.getBeansOfType(ProcessEngine.class);
        if ((beansOfType == null) || (beansOfType.isEmpty())) {
            throw new ActivitiException(
                "no " + ProcessEngine.class.getName() + " defined in the application context " + resource.toString()
            );
        }

        ProcessEngine processEngine = beansOfType.values().iterator().next();

        log.debug(
            "==== SPRING PROCESS ENGINE CREATED =================================================================="
        );
        return processEngine;
    }
}

View on GitHub (pinned to 56435b1a97)