flowable/flowable-engine · error · FlowableException

No cdi bean manager available, cannot publish event.

Error message

No cdi bean manager available, cannot publish event.

What it means

CdiExecutionListener.getBeanManager() throws FlowableException when BeanManagerLookup returns null while an execution listener tries to publish a CDI business event. Without a BeanManager the CDI event machinery cannot fire, so the engine aborts rather than silently dropping events. This means the flowable-cdi module is active but no CDI container/BeanManager was resolvable.

Source

Thrown at modules/flowable-cdi/src/main/java/org/flowable/cdi/impl/event/CdiExecutionListener.java:87

            return;
        }

        BusinessProcessEvent event = createEvent(execution);
        Annotation[] qualifiers = getQualifiers(event);
        getBeanManager().getEvent().select(qualifiers).fire(event);
    }

    protected BusinessProcessEvent createEvent(DelegateExecution execution) {
        ProcessDefinition processDefinition = ProcessDefinitionUtil.getProcessDefinition(execution.getProcessDefinitionId());
        ProcessEngineConfiguration engineConfiguration = org.flowable.engine.impl.context.Context.getProcessEngineConfiguration(); 
        Date now = engineConfiguration.getClock().getCurrentTime();
        return new CdiBusinessProcessEvent(activityId, transitionName, processDefinition, execution, type, execution.getProcessInstanceId(), execution.getId(), now);
    }

    protected BeanManager getBeanManager() {
        BeanManager bm = BeanManagerLookup.getBeanManager();
        if (bm == null) {
            throw new FlowableException("No cdi bean manager available, cannot publish event.");
        }
        return bm;
    }

    protected Annotation[] getQualifiers(BusinessProcessEvent event) {
        Annotation businessProcessQualifier = new BusinessProcessLiteral(event.getProcessDefinition().getKey());
        if (type == BusinessProcessEventType.TAKE) {
            return new Annotation[] { businessProcessQualifier, new TakeTransitionLiteral(transitionName) };
        }
        if (type == BusinessProcessEventType.START_ACTIVITY) {
            return new Annotation[] { businessProcessQualifier, new StartActivityLiteral(activityId) };
        }
        if (type == BusinessProcessEventType.END_ACTIVITY) {
            return new Annotation[] { businessProcessQualifier, new EndActivityLiteral(activityId) };
        }
        return new Annotation[] {};
    }
}

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Set the BeanManager explicitly: BeanManagerLookup.setLocalInstance(beanManager) at startup before the engine processes events.
  2. Remove flowable-cdi from the classpath/ dependencies if you are not using CDI (use flowable-engine + Spring integration instead).
  3. In an app server, ensure CDI is enabled (beans.xml with bean-discovery-mode annotated/all) so JNDI java:comp/BeanManager resolves.
  4. Register non-CDI listeners (FlowableEventListener via engine configuration) instead of CDI execution listeners.

Example fix

// before: engine boots without CDI and listeners fire
// after: in application startup (CDI env)
BeanManagerLookup.setLocalInstance(CDI.current().select(BeanManager.class).get());
Defensive patterns

Strategy: validation

Validate before calling

if (org.flowable.cdi.impl.util.BeanManagerLookup.getBeanManager() == null) {
    org.flowable.cdi.impl.util.BeanManagerLookup.setLocalInstance(
        jakarta.enterprise.inject.spi.CDI.current().select(jakarta.enterprise.inject.spi.BeanManager.class).get());
}

Type guard

boolean cdiEventPublishingAvailable() {
    return org.flowable.cdi.impl.util.BeanManagerLookup.getBeanManager() != null;
}

Try / catch

try {
    executionListener.notify(delivery);
} catch (org.flowable.common.engine.api.FlowableException e) {
    if (e.getMessage().contains("No cdi bean manager")) {
        logger.warn("CDI events skipped: no BeanManager");
    } else { throw e; }
}

Prevention

When it happens

Trigger: An execution listener fires (process/ activity events) and BeanManagerLookup.getBeanManager() returns null — the lookup via JNDI and localInstance both failed, e.g. running in a non-CDI (plain Spring/ plain Java) environment with flowable-cdi on the classpath.

Common situations: Embedding Flowable in Spring Boot or a plain SE app while a CDI-aware engine configuration or listener is registered; missing beans.xml / CDI activation; running tests outside an app server without setting the localInstance BeanManager.

Understand the failure class

Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/d0dc0d590fbeb2d5. Report an issue: GitHub.