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

  1. 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).
  2. Skip JNDI entirely: call BeanManagerLookup.setLocalInstance(beanManager) at startup.
  3. Verify the binding exists with a standalone JNDI dump / server console before wiring it.
  4. 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

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


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