{"record":{"id":"42798d28df9e12b9","repo":"flowable/flowable-engine","slug":"could-not-find-camelcontext-named-camelcontextva","errorCode":null,"errorMessage":"Could not find CamelContext named ${camelContextValue}.","messagePattern":"Could not find CamelContext named (.+?)\\.","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-camel/src/main/java/org/flowable/camel/SpringCamelBehavior.java","lineNumber":80,"sourceCode":"    protected CamelContext resolveCamelContext(String camelContextValue, boolean isV5Execution) {\n        ProcessEngineConfiguration engineConfiguration = org.flowable.engine.impl.context.Context.getProcessEngineConfiguration();\n        if (isV5Execution) {\n\n            Flowable5CompatibilityHandler compatibilityHandler = Flowable5Util.getFlowable5CompatibilityHandler();\n            return (CamelContext) compatibilityHandler.getCamelContextObject(camelContextValue);\n\n        } else {\n            // Convert it to a SpringProcessEngineConfiguration. If this doesn't work, throw a RuntimeException.\n            try {\n                SpringProcessEngineConfiguration springConfiguration = (SpringProcessEngineConfiguration) engineConfiguration;\n                if (StringUtils.isEmpty(camelContextValue)) {\n                    camelContextValue = springConfiguration.getDefaultCamelContext();\n                }\n\n                // Get the CamelContext object and set the super's member variable.\n                Object ctx = springConfiguration.getApplicationContext().getBean(camelContextValue);\n                if (!(ctx instanceof SpringCamelContext)) {\n                    throw new FlowableException(\"Could not find CamelContext named \" + camelContextValue + \".\");\n                }\n                return (SpringCamelContext) ctx;\n\n            } catch (Exception e) {\n                throw new FlowableException(\"Expecting a SpringProcessEngineConfiguration for the Camel module.\", e);\n            }\n        }\n    }\n\n    \n}\n","sourceCodeStart":62,"sourceCodeEnd":92,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-camel/src/main/java/org/flowable/camel/SpringCamelBehavior.java#L62-L92","documentation":"SpringCamelBehavior.resolveCamelContext looks up the named Spring bean via the application context from a SpringProcessEngineConfiguration and requires it to be a SpringCamelContext. Flowable throws this FlowableException when the bean with the configured camelContext name exists but is not a SpringCamelContext instance.","triggerScenarios":"The 'camelContext' field on the camel behavior/service task points at a bean whose type is not SpringCamelContext (e.g. a plain DefaultCamelContext, or the bean lookup returned a different type), or getBean returned null/non-Camel bean with the given name.","commonSituations":"Referencing a DefaultCamelContext bean instead of SpringCamelContext in a Spring application; typos mapping to another bean of unrelated type; using camel-spring vs plain camel inconsistently; specifying a camelContext name that resolves to null inside getBean when the name key was picked from the wrong source.","solutions":["Make sure the referenced bean is a org.apache.camel.spring.SpringCamelContext declared in the Spring application context.","Check the camelContext attribute/field value on the flowable service task or SpringCamelBehavior configuration points at the correct bean name.","Do not use a manually constructed DefaultCamelContext; create the context via spring <camelContext> or CamelSpringBootApplication so the bean type is SpringCamelContext.","Verify springConfiguration is a SpringProcessEngineConfiguration and the applicationContext contains the bean."],"exampleFix":"// before\n<bean id=\"camelContext\" class=\"org.apache.camel.impl.DefaultCamelContext\"/>\n// after\n<camelContext id=\"camelContext\" xmlns=\"http://camel.apache.org/schema/spring\"/> <!-- SpringCamelContext -->","handlingStrategy":"validation","validationCode":"Object bean = springConfiguration.getApplicationContext().getBean(camelContextName);\nif (!(bean instanceof SpringCamelContext)) {\n    throw new IllegalStateException(\"Bean '\" + camelContextName + \"' must be a SpringCamelContext\");\n}","typeGuard":"if (obj instanceof org.apache.camel.spring.SpringCamelContext sc) { /* safe to use */ }","tryCatchPattern":"try {\n    return springCamelBehavior.getCamelContext();\n} catch (FlowableException e) {\n    if (e.getMessage().startsWith(\"Could not find CamelContext named\")) {\n        // log bean name + actual bean type for diagnosis\n    }\n    throw e;\n}","preventionTips":["Define Camel contexts via camel-spring so beans are SpringCamelContext instances.","Double-check the camelContext name referenced by flowable service tasks.","Do not register plain DefaultCamelContext beans where Spring lookup is used."],"tags":["camel","flowable","spring","camelcontext-lookup"],"backgroundTag":"type-mismatch","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"}