{"record":{"id":"9b00b3e80987026d","repo":"flowable/flowable-engine","slug":"could-not-resolve-the-jmslistenercontainerfactory","errorCode":null,"errorMessage":"Could not resolve the JmsListenerContainerFactory to use for [<endpoint>] no factory was given and no default is set.","messagePattern":"Could not resolve the JmsListenerContainerFactory to use for \\[<endpoint>\\] no factory was given and no default is set\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"modules/flowable-event-registry-spring/src/main/java/org/flowable/eventregistry/spring/jms/JmsChannelModelProcessor.java","lineNumber":232,"sourceCode":"        // This also makes sure that we are not going to start our listener earlier than the JmsListenerEndpointRegistry\n        boolean startImmediately = contextRefreshed || endpointRegistry.isRunning();\n        logger.info(\"Registering endpoint {} with start immediately {}\", endpoint, startImmediately);\n        endpointRegistry.registerListenerContainer(endpoint, resolveContainerFactory(endpoint, factory), startImmediately);\n        logger.info(\"Finished registering endpoint {}\", endpoint);\n    }\n\n    protected JmsListenerContainerFactory<?> resolveContainerFactory(JmsListenerEndpoint endpoint, JmsListenerContainerFactory<?> containerFactory) {\n        if (containerFactory != null) {\n            return containerFactory;\n        } else if (this.containerFactory != null) {\n            return this.containerFactory;\n        } else if (containerFactoryBeanName != null) {\n            Assert.state(beanFactory != null, \"BeanFactory must be set to obtain container factory by bean name\");\n            // Consider changing this if live change of the factory is required...\n            this.containerFactory = beanFactory.getBean(containerFactoryBeanName, JmsListenerContainerFactory.class);\n            return this.containerFactory;\n        } else {\n            throw new IllegalStateException(\"Could not resolve the \" +\n                JmsListenerContainerFactory.class.getSimpleName() + \" to use for [\" +\n                endpoint + \"] no factory was given and no default is set.\");\n        }\n    }\n\n    protected String getEndpointId(ChannelModel channelModel, String tenantId) {\n        String channelDefinitionKey = channelModel.getKey();\n        if (!StringUtils.hasText(tenantId)) {\n            return CHANNEL_ID_PREFIX + channelDefinitionKey;\n        }\n        return CHANNEL_ID_PREFIX + tenantId + \"#\" + channelDefinitionKey;\n    }\n\n    protected String resolve(String value) {\n        if (embeddedValueResolver != null) {\n            return embeddedValueResolver.resolveStringValue(value);\n        } else {\n            return value;","sourceCodeStart":214,"sourceCodeEnd":250,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-event-registry-spring/src/main/java/org/flowable/eventregistry/spring/jms/JmsChannelModelProcessor.java#L214-L250","documentation":"resolveContainerFactory (mirroring Spring's JmsListenerAnnotationBeanPostProcessor logic) determines which JmsListenerContainerFactory builds the endpoint's listener container. If no factory was set directly, no containerFactoryBeanName was configured, and no default factory exists, it throws an IllegalStateException naming the endpoint.","triggerScenarios":"registerEndpoint for a JMS channel where neither a container factory instance, a container factory bean name, nor a default JmsListenerContainerFactory bean is available in the BeanFactory.","commonSituations":"No 'jmsListenerContainerFactory' bean defined in the Spring context; channel model's container-factory reference misconfigured; BeanFactory not injected into the processor.","solutions":["Define a default JmsListenerContainerFactory bean named 'jmsListenerContainerFactory' in your Spring context.","Set the channel model's container factory bean name to an existing JmsListenerContainerFactory bean.","Ensure the JmsChannelModelProcessor's beanFactory is set if resolving the factory by bean name.","Verify the factory bean type is JmsListenerContainerFactory (not, e.g., a Kafka factory)."],"exampleFix":"// before: no factory bean\n\n// after\n@Bean\npublic DefaultJmsListenerContainerFactory jmsListenerContainerFactory(ConnectionFactory cf) {\n    DefaultJmsListenerContainerFactory f = new DefaultJmsListenerContainerFactory();\n    f.setConnectionFactory(cf);\n    return f;\n}","handlingStrategy":"validation","validationCode":"if (beanFactory != null && !beanFactory.containsBean(\"jmsListenerContainerFactory\")) {\n    throw new IllegalStateException(\"Define a jmsListenerContainerFactory bean before registering JMS endpoints\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    processor.registerEndpoint(channelModel, tenantId);\n} catch (IllegalStateException e) {\n    log.error(\"No JmsListenerContainerFactory for endpoint {}\", channelModel.getKey(), e);\n}","preventionTips":["Always define a jmsListenerContainerFactory bean in Spring contexts using JMS channels.","Set explicit container factory bean names in channel models.","Ensure the processor's beanFactory is injected."],"tags":["jms","spring","configuration","listener-container"],"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-18T11:17:12.947Z"}