flowable/flowable-engine · error · FlowableException
Could not lookup beanmanager in jndi using name: '${jndiName
Error message
Could not lookup beanmanager in jndi using name: '${jndiName}'. What it means
BeanManagerLookup.lookupBeanManagerInJndi() throws FlowableException when an explicit JNDI name was configured but InitialContext.doLookup(name) throws NamingException. The configured JNDI name does not point to a bound javax.enterprise.inject.spi.BeanManager. The original NamingException is attached as the cause.
Source
Thrown at modules/flowable-cdi/src/main/java/org/flowable/cdi/impl/util/BeanManagerLookup.java:42
public static BeanManager localInstance;
/** provide a custom jndi lookup name */
public static String jndiName;
public static BeanManager getBeanManager() {
if (localInstance != null) {
return localInstance;
}
return lookupBeanManagerInJndi();
}
private static BeanManager lookupBeanManagerInJndi() {
if (jndiName != null) {
try {
return (BeanManager) InitialContext.doLookup(jndiName);
} catch (NamingException e) {
throw new FlowableException("Could not lookup beanmanager in jndi using name: '" + jndiName + "'.", e);
}
}
try {
// in an application server
return (BeanManager) InitialContext.doLookup("java:comp/BeanManager");
} catch (NamingException e) {
// silently ignore
}
try {
// in a servlet container
return (BeanManager) InitialContext.doLookup("java:comp/env/BeanManager");
} catch (NamingException e) {
// silently ignore
}
throw new FlowableException("Could not lookup beanmanager in jndi. If no jndi is available, set the beanmanger to the 'localInstance' property of this class.");
View on GitHub (pinned to d6d39ce1c6)
Solutions
- Correct the configured jndiName to the BeanManager binding of your container (e.g. java:comp/BeanManager on Java EE, java:comp/env/BeanManager on servlet containers with Weld).
- Skip JNDI entirely: call BeanManagerLookup.setLocalInstance(beanManager) at startup.
- Verify the binding exists with a standalone JNDI dump / server console before wiring it.
- Ensure the CDI provider (Weld/ OpenWebBeans) is actually installed and initialized in that deployment.
Example fix
// before
BeanManagerLookup.setJndiName("java:global/BeanManager"); // not bound
// after
BeanManagerLookup.setJndiName("java:comp/BeanManager");
// or: BeanManagerLookup.setLocalInstance(beanManager); Defensive patterns
Strategy: fallback
Validate before calling
try {
new javax.naming.InitialContext().lookup(jndiName);
} catch (javax.naming.NamingException e) {
BeanManagerLookup.setLocalInstance(cdiBeanManager); // fall back before engine starts
} Type guard
boolean jndiBeanManagerBound(String name) {
try { new javax.naming.InitialContext().lookup(name); return true; }
catch (javax.naming.NamingException e) { return false; }
} Try / catch
try {
bm = BeanManagerLookup.getBeanManager();
} catch (org.flowable.common.engine.api.FlowableException e) {
bm = CDI.current().select(BeanManager.class).get(); // direct CDI container access
} Prevention
- Confirm the JNDI binding with your container's console before configuring jndiName.
- Prefer setLocalInstance over JNDI when embedding Flowable outside a full app server.
- Attach resource-ref entries (web.xml/ server config) so the BeanManager is bound in java:comp.
- Log the resolved JNDI name at startup to catch config drift.
When it happens
Trigger: BeanManagerLookup.jndiName was set (via flowable-cdi config or a custom jndi.properties) to a name under which no BeanManager is bound; InitialContext.doLookup(jndiName) fails with NamingException.
Common situations: Wrong JNDI name for the app server (e.g. Tomcat binds java:comp/env/BeanManager after CDI setup; WebSphere/WebLogic use different names); copying a JNDI name from a different container; missing resource reference in web.xml/ application-server config.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Could not lookup beanmanager in jndi. If no jndi is availabl
- No cdi bean manager available, cannot publish event.
- No cdi bean manager available, cannot publish event.
- Cannot use this method of the BusinessProcess bean within an
- Cannot use startProcessByName in an active command.
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/714c8311fedd70c8.
Report an issue: GitHub.