flowable/flowable-engine · error · NullPointerException

context is null

Error message

context is null

What it means

JsonNodeELResolver.getType() implements the JUEL/EL contract, which mandates an immediate NullPointerException when the passed ELContext is null before doing any resolution. It is a defensive precondition check protecting the resolver's use of context.setPropertyResolved().

Solutions

  1. Always pass a valid, non-null ELContext (e.g. StandardELContext or the engine-provided context)
  2. In custom callers, assert/initialize the ELContext before invoking resolver methods
  3. Use the resolver only through a proper EL processor (ExpressionFactory) which supplies the context automatically

Example fix

// before
resolver.getType(null, jsonNode, "field"); // NPE
// after
ELContext ctx = factory.getELContext(resolver);
resolver.getType(ctx, jsonNode, "field");
Defensive patterns

Strategy: validation

Validate before calling

if (context == null) {
    throw new IllegalArgumentException("An ELContext is required before calling JsonNodeELResolver.getType");
}
resolver.getType(context, base, property);

Type guard

boolean ready = context != null; // establish before invoking resolver
if (!ready) context = factory.getELContext(resolver);

Try / catch

try {
    return resolver.getType(context, base, property);
} catch (NullPointerException e) {
    if ("context is null".equals(e.getMessage())) {
        throw new IllegalArgumentException("ELContext must be provided to JsonNodeELResolver", e);
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling resolver.getType(context, base, property) programmatically with a null ELContext; an EL implementation invoking the resolver without a context.

Common situations: Custom code or tests invoking the ELResolver API directly and forgetting the context argument; embedding JsonNodeELResolver in a non-Flowable EL setup where the context is not wired.

Related errors


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

Appendix: source

Thrown at modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/el/JsonNodeELResolver.java:87

     * this resolver, before returning. If this property is not true after this method is called, the caller should ignore the return value. Assuming the base is a Map, this method will always return
     * Object.class. This is because Maps accept any object as the value for a given key.
     * 
     * @param context
     *            The context of this evaluation.
     * @param base
     *            The map to analyze. Only bases of type Map are handled by this resolver.
     * @param property
     *            The key to return the acceptable type for. Ignored by this resolver.
     * @return If the propertyResolved property of ELContext was set to true, then the most general acceptable type; otherwise undefined.
     * @throws NullPointerException
     *             if context is null
     * @throws ELException
     *             if an exception was thrown while performing the property or variable resolution. The thrown exception must be included as the cause property of this exception, if available.
     */
    @Override
    public Class<?> getType(ELContext context, Object base, Object property) {
        if (context == null) {
            throw new NullPointerException("context is null");
        }
        Class<?> result = null;
        if (isResolvable(base)) {
            result = Object.class;
            context.setPropertyResolved(true);
        }
        return result;
    }

    /**
     * If the base object is a map, returns the value associated with the given key, as specified by the property argument. If the key was not found, null is returned. If the base is a Map, the
     * propertyResolved property of the ELContext object must be set to true by this resolver, before returning. If this property is not true after this method is called, the caller should ignore the
     * return value. Just as in java.util.Map.get(Object), just because null is returned doesn't mean there is no mapping for the key; it's also possible that the Map explicitly maps the key to null.
     * 
     * @param context
     *            The context of this evaluation.
     * @param base
     *            The map to analyze. Only bases of type Map are handled by this resolver.

View on GitHub (pinned to d6d39ce1c6)