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

CdiTaskListener.getBeanManager() throws FlowableException when BeanManagerLookup yields null while a task listener publishes 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/CdiTaskListener.java:87

            return;
        }

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

    protected BusinessProcessEvent createEvent(DelegateTask task) {
        ProcessEngineConfigurationImpl engineConfiguration = org.flowable.engine.impl.context.Context.getProcessEngineConfiguration();
        ProcessDefinition processDefinition = engineConfiguration.getProcessDefinitionCache().get(task.getProcessDefinitionId()).getProcessDefinition();
        Date now = engineConfiguration.getClock().getCurrentTime();
        return new CdiBusinessProcessEvent(activityId, transitionName, processDefinition, task, type, task.getProcessInstanceId(), task.getExecutionId(), 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.CREATE_TASK) {
            return new Annotation[] { businessProcessQualifier, new CreateTaskLiteral(activityId) };
        }
        if (type == BusinessProcessEventType.ASSIGN_TASK) {
            return new Annotation[] { businessProcessQualifier, new AssignTaskLiteral(activityId) };
        }
        if (type == BusinessProcessEventType.COMPLETE_TASK) {
            return new Annotation[] { businessProcessQualifier, new CompleteTaskLiteral(activityId) };
        }
        if (type == BusinessProcessEventType.DELETE_TASK) {
            return new Annotation[] { businessProcessQualifier, new DeleteTaskLiteral(activityId) };
        }

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Set BeanManagerLookup.setLocalInstance(beanManager) during application startup before tasks execute.
  2. Remove flowable-cdi dependencies/listeners if CDI is not your runtime (use Spring integration or plain event listeners instead).
  3. Enable CDI in the deployment (beans.xml, bean-discovery-mode) so java:comp/BeanManager is available in JNDI.
  4. Replace CDI task listeners with engine TaskListeners/ FlowableEventListener implementations that don't need CDI.

Example fix

// before: listener throws at runtime in tests
// after: test setup
BeanManagerLookup.setLocalInstance(mockOrRealBeanManager);
engine = ProcessEngineConfiguration...buildProcessEngine();
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 canPublishCdiTaskEvents() {
    return org.flowable.cdi.impl.util.BeanManagerLookup.getBeanManager() != null;
}

Try / catch

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

Prevention

When it happens

Trigger: A task listener fires (task create/assign/complete) and BeanManagerLookup.getBeanManager() returns null — both JNDI lookups and the localInstance fallback failed, e.g. in a non-CDI environment with flowable-cdi listeners wired into the engine.

Common situations: Spring Boot or plain Java apps that accidentally include flowable-cdi listeners; missing beans.xml/ CDI activation in a WAR; unit tests booting the engine outside an app server without a localInstance BeanManager set.

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