{"record":{"id":"62af8b82d31bb07f","repo":"Activiti/Activiti","slug":"no-org-activiti-engine-processengine-defined-in-th","errorCode":null,"errorMessage":"no org.activiti.engine.ProcessEngine defined in the application context ${resource}","messagePattern":"no org\\.activiti\\.engine\\.ProcessEngine defined in the application context (.+?)","errorType":"exception","errorClass":"ActivitiException","httpStatus":null,"severity":"error","filePath":"activiti-core/activiti-spring/src/main/java/org/activiti/spring/SpringConfigurationHelper.java","lineNumber":43,"sourceCode":"import org.springframework.context.support.GenericXmlApplicationContext;\nimport org.springframework.core.io.UrlResource;\n\n/**\n\n */\npublic class SpringConfigurationHelper {\n\n    private static Logger log = LoggerFactory.getLogger(SpringConfigurationHelper.class);\n\n    public static ProcessEngine buildProcessEngine(URL resource) {\n        log.debug(\n            \"==== BUILDING SPRING APPLICATION CONTEXT AND PROCESS ENGINE =========================================\"\n        );\n\n        ApplicationContext applicationContext = new GenericXmlApplicationContext(new UrlResource(resource));\n        Map<String, ProcessEngine> beansOfType = applicationContext.getBeansOfType(ProcessEngine.class);\n        if ((beansOfType == null) || (beansOfType.isEmpty())) {\n            throw new ActivitiException(\n                \"no \" + ProcessEngine.class.getName() + \" defined in the application context \" + resource.toString()\n            );\n        }\n\n        ProcessEngine processEngine = beansOfType.values().iterator().next();\n\n        log.debug(\n            \"==== SPRING PROCESS ENGINE CREATED ==================================================================\"\n        );\n        return processEngine;\n    }\n}\n","sourceCodeStart":25,"sourceCodeEnd":56,"githubUrl":"https://github.com/Activiti/Activiti/blob/56435b1a97deeafdc09dd40074b056c89fba5a8a/activiti-core/activiti-spring/src/main/java/org/activiti/spring/SpringConfigurationHelper.java#L25-L56","documentation":"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.","triggerScenarios":"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).","commonSituations":"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).","solutions":["Add a ProcessEngine bean (org.activiti.spring.ProcessEngineFactoryBean with a SpringProcessEngineConfiguration) to the referenced XML context.","Ensure the helper is pointed at the correct Spring XML resource containing the engine definition.","Check the XML loads without errors — a failing bean definition can leave the context without the engine bean.","Migrate to Spring Boot auto-configuration (activiti-spring-boot-starter) if XML configuration is no longer desired."],"exampleFix":"// before (spring xml)\n<bean id=\"dataSource\" class=\"...\"/>\n// after (spring xml)\n<bean id=\"processEngineConfiguration\" class=\"org.activiti.spring.SpringProcessEngineConfiguration\">\n  <property name=\"dataSource\" ref=\"dataSource\"/>\n  <property name=\"transactionManager\" ref=\"transactionManager\"/>\n</bean>\n<bean id=\"processEngine\" class=\"org.activiti.spring.ProcessEngineFactoryBean\">\n  <property name=\"processEngineConfiguration\" ref=\"processEngineConfiguration\"/>\n</bean>","handlingStrategy":"validation","validationCode":"GenericXmlApplicationContext ctx = new GenericXmlApplicationContext(new UrlResource(xmlResource));\nif (ctx.getBeansOfType(ProcessEngine.class).isEmpty()) {\n    throw new IllegalStateException(\"XML context has no ProcessEngine bean: \" + xmlResource);\n}","typeGuard":null,"tryCatchPattern":"try {\n    ProcessEngine engine = SpringConfigurationHelper.buildProcessEngine(resource);\n} catch (ActivitiException e) {\n    throw new IllegalStateException(\"Check that \" + resource + \" defines a ProcessEngine bean\", e);\n}","preventionTips":["Always define a ProcessEngineFactoryBean in Spring XMLs used with this helper.","Point the helper at the specific XML containing engine configuration.","Verify context bean types after refactoring bean ids/classes.","Prefer Spring Boot auto-configuration to avoid manual XML engine wiring."],"tags":["spring","xml-configuration","process-engine","missing-bean"],"backgroundTag":"missing-required-config","analyzedSha":"56435b1a97deeafdc09dd40074b056c89fba5a8a","analyzedAt":"2026-09-09T21:00:06.703Z","contentChangedAt":"2026-09-09T21:00:06.703Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}