flowable/flowable-engine · error · ActivitiException

no defined in the application context

Error message

no  defined in the application context 

What it means

Thrown by SpringConfigurationHelper.buildProcessEngine when the Spring XML application context loaded from the given URL does not contain any bean of type ProcessEngine. The helper expects the context to define exactly the process engine bean it can return.

Source

Thrown at modules/flowable5-spring/src/main/java/org/activiti/spring/SpringConfigurationHelper.java:40

import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.GenericXmlApplicationContext;
import org.springframework.core.io.UrlResource;

/**
 * @author Tom Baeyens
 */
public class SpringConfigurationHelper {

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

    private static ProcessEngine buildProcessEngine(URL resource) {
        LOGGER.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);
        }

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

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

}

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Add a <bean id="processEngine" class="...ProcessEngineFactoryBean"> (flowable/activiti) to the XML context.
  2. Verify the resource URL points to the intended spring configuration file.
  3. Ensure the factory bean produces a ProcessEngine and the context loads without errors (check logged warnings).
  4. Check getBeansOfType filters — the bean must be declared with a type assignable to ProcessEngine.

Example fix

// before
<beans>...no engine bean...</beans>
// after
<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(url));
if (ctx.getBeansOfType(ProcessEngine.class).isEmpty()) throw new IllegalStateException("Resource has no ProcessEngine bean: " + url);

Try / catch

try { ProcessEngine pe = SpringConfigurationHelper.buildProcessEngine(url); } catch (ActivitiException e) { log.error("No ProcessEngine bean in context {}", url, e); }

Prevention

When it happens

Trigger: Calling SpringConfigurationHelper.buildProcessEngine(url) with an XML resource that has no ProcessEngine bean (e.g. wrong file, missing spring-engine wiring, or the bean is defined with a type not exposed as ProcessEngine).

Common situations: Pointing at the wrong spring XML file; a context that defines ProcessEngineConfiguration but never builds the ProcessEngine bean; context failing silently so beans never registered; typo in bean class attribute.

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 flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/941b3a5e659a3482. Report an issue: GitHub.