{"record":{"id":"941b3a5e659a3482","repo":"flowable/flowable-engine","slug":"no-defined-in-the-application-context","errorCode":null,"errorMessage":"no  defined in the application context ","messagePattern":"no  defined in the application context ","errorType":"exception","errorClass":"ActivitiException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-spring/src/main/java/org/activiti/spring/SpringConfigurationHelper.java","lineNumber":40,"sourceCode":"import org.slf4j.LoggerFactory;\nimport org.springframework.context.ApplicationContext;\nimport org.springframework.context.support.GenericXmlApplicationContext;\nimport org.springframework.core.io.UrlResource;\n\n/**\n * @author Tom Baeyens\n */\npublic class SpringConfigurationHelper {\n\n    private static final Logger LOGGER = LoggerFactory.getLogger(SpringConfigurationHelper.class);\n\n    private static ProcessEngine buildProcessEngine(URL resource) {\n        LOGGER.debug(\"==== BUILDING SPRING APPLICATION CONTEXT AND PROCESS ENGINE =========================================\");\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(\"no \" + ProcessEngine.class.getName() + \" defined in the application context \" + resource);\n        }\n\n        ProcessEngine processEngine = beansOfType.values().iterator().next();\n\n        LOGGER.debug(\"==== SPRING PROCESS ENGINE CREATED ==================================================================\");\n        return processEngine;\n    }\n\n}\n","sourceCodeStart":22,"sourceCodeEnd":50,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-spring/src/main/java/org/activiti/spring/SpringConfigurationHelper.java#L22-L50","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Add a <bean id=\"processEngine\" class=\"...ProcessEngineFactoryBean\"> (flowable/activiti) to the XML context.","Verify the resource URL points to the intended spring configuration file.","Ensure the factory bean produces a ProcessEngine and the context loads without errors (check logged warnings).","Check getBeansOfType filters — the bean must be declared with a type assignable to ProcessEngine."],"exampleFix":"// before\n<beans>...no engine bean...</beans>\n// after\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(url));\nif (ctx.getBeansOfType(ProcessEngine.class).isEmpty()) throw new IllegalStateException(\"Resource has no ProcessEngine bean: \" + url);","typeGuard":null,"tryCatchPattern":"try { ProcessEngine pe = SpringConfigurationHelper.buildProcessEngine(url); } catch (ActivitiException e) { log.error(\"No ProcessEngine bean in context {}\", url, e); }","preventionTips":["Verify the spring XML defines a ProcessEngineFactoryBean bean","Validate the resource URL before calling buildProcessEngine","Boot the context once in a startup test to catch missing beans early"],"tags":["spring","configuration","process-engine"],"backgroundTag":"missing-required-config","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}