flowable/flowable-engine · error · IllegalStateException

Could not resolve the RabbitListenerContainerFactory to use

Error message

Could not resolve the RabbitListenerContainerFactory to use for [{endpoint}] no factory was given and no default is set.

What it means

Thrown by resolveContainerFactory when no RabbitListenerContainerFactory can be determined for a listener endpoint: no factory was set on the processor and no default factory bean exists. Copied from Spring AMQP's RabbitListenerAnnotationBeanPostProcessor behavior; registration cannot proceed without a factory.

Source

Thrown at modules/flowable-event-registry-spring/src/main/java/org/flowable/eventregistry/spring/rabbit/RabbitChannelDefinitionProcessor.java:351

        // This also makes sure that we are not going to start our listener earlier than the RabbitListenerEndpointRegistry
        boolean startImmediately = contextRefreshed || endpointRegistry.isRunning();
        logger.info("Registering endpoint {} with start immediately {}", endpoint, startImmediately);
        endpointRegistry.registerListenerContainer(endpoint, resolveContainerFactory(endpoint, factory), startImmediately);
        logger.info("Finished registering endpoint {}", endpoint);
    }

    protected RabbitListenerContainerFactory<?> resolveContainerFactory(RabbitListenerEndpoint endpoint, RabbitListenerContainerFactory<?> containerFactory) {
        if (containerFactory != null) {
            return containerFactory;
        } else if (this.containerFactory != null) {
            return this.containerFactory;
        } else if (containerFactoryBeanName != null) {
            Assert.state(beanFactory != null, "BeanFactory must be set to obtain container factory by bean name");
            // Consider changing this if live change of the factory is required...
            this.containerFactory = beanFactory.getBean(containerFactoryBeanName, RabbitListenerContainerFactory.class);
            return this.containerFactory;
        } else {
            throw new IllegalStateException("Could not resolve the " +
                RabbitListenerContainerFactory.class.getSimpleName() + " to use for [" +
                endpoint + "] no factory was given and no default is set.");
        }
    }

    protected String getEndpointId(ChannelModel channelModel, String tenantId) {
        String channelDefinitionKey = channelModel.getKey();
        if (!StringUtils.hasText(tenantId)) {
            return CHANNEL_ID_PREFIX + channelDefinitionKey;
        }
        return CHANNEL_ID_PREFIX + tenantId + "#" + channelDefinitionKey;
    }

    protected String resolve(String value) {
        if (value == null) {
            return null;
        } else if (embeddedValueResolver != null) {
            return embeddedValueResolver.resolveStringValue(value);

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Define a RabbitListenerContainerFactory bean named 'rabbitListenerContainerFactory' in the Spring context
  2. Set containerFactoryBeanName on the processor to point to an existing factory bean
  3. Ensure a BeanFactory is set on the processor when resolving by bean name
  4. Verify spring-rabbit is on the classpath and RabbitAutoConfiguration is not excluded

Example fix

// before
RabbitChannelDefinitionProcessor p = new RabbitChannelDefinitionProcessor(); // no factory configured
// after
@Bean
public RabbitListenerContainerFactory<?> rabbitListenerContainerFactory(ConnectionFactory cf) {
    SimpleRabbitListenerContainerFactory f = new SimpleRabbitListenerContainerFactory();
    f.setConnectionFactory(cf);
    return f;
}
Defensive patterns

Strategy: validation

Validate before calling

if (beanFactory == null || !beanFactory.containsBean("rabbitListenerContainerFactory")) { throw new IllegalStateException("Define a RabbitListenerContainerFactory bean before registering rabbit channels"); }

Type guard

boolean factoryAvailable = ctx.getBeanNamesForType(RabbitListenerContainerFactory.class).length > 0;

Try / catch

try { registerEndpoint(endpoint); } catch (IllegalStateException e) { log.error("No RabbitListenerContainerFactory configured: {}", e.getMessage()); }

Prevention

When it happens

Trigger: registerEndpoint called with neither a resolved containerFactory nor containerFactoryBeanName, and beanFactory lookup yields no default factory named RabbitListenerConfigUtils.DEFAULT_RABBIT_LISTENER_CONTAINER_FACTORY_BEAN_NAME.

Common situations: Missing @Configuration with RabbitListenerContainerFactory bean; custom Spring Boot auto-configuration disabled; containerFactoryBeanName typo; using the Flowable Rabbit channel processor without the standard spring-rabbit configuration.

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/e45d826d8359c13f. Report an issue: GitHub.