flowable/flowable-engine · error · FlowableIllegalArgumentException

entityClass is null

Error message

entityClass is null

What it means

GetTableNameCmd resolves the database table name for a Flowable entity class. The command validates its entityClass constructor argument before doing any work; since the table lookup (EntityToTableMap.getTableName) requires a concrete entity type, a null class cannot resolve to a table, so a FlowableIllegalArgumentException is thrown immediately.

Solutions

  1. Pass a concrete Flowable entity class, e.g. new GetTableNameCmd(org.flowable.idm.api.User.class)
  2. Check where the Class value comes from; fix the reflection/config lookup that produced null
  3. Wrap the call in try-catch FlowableIllegalArgumentException only if null is an expected input to handle gracefully

Example fix

// before
String table = managementService.executeCommand(new GetTableNameCmd(entityClass));
// after
if (entityClass == null) {
    entityClass = org.flowable.idm.api.User.class; // or fail fast with a clear message
}
String table = managementService.executeCommand(new GetTableNameCmd(entityClass));
Defensive patterns

Strategy: validation

Validate before calling

if (entityClass == null) throw new IllegalArgumentException("entityClass must be a non-null Flowable entity Class");

Type guard

boolean isValidEntity(Class<?> c) { return c != null && (org.flowable.idm.api.User.class.isAssignableFrom(c) || c == org.flowable.idm.api.Group.class); }

Try / catch

try { String table = cmd.execute(ctx); } catch (FlowableIllegalArgumentException e) { log.error("No entity class supplied", e); }

Prevention

When it happens

Trigger: Calling managementService executeCommand(new GetTableNameCmd(null)) or invoking an API wrapper (e.g. table-name query helpers) while passing a null Class<?> argument for the entity.

Common situations: Building dynamic queries where the entity class is resolved via reflection or configuration and the resolution silently returns null (typo'd class name, missing module dependency, uninitialized field).

Related errors


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

Appendix: source

Thrown at modules/flowable-idm-engine/src/main/java/org/flowable/idm/engine/impl/cmd/GetTableNameCmd.java:37

import org.flowable.common.engine.api.FlowableIllegalArgumentException;
import org.flowable.common.engine.impl.interceptor.Command;
import org.flowable.common.engine.impl.interceptor.CommandContext;
import org.flowable.idm.engine.impl.db.EntityToTableMap;

public class GetTableNameCmd implements Command<String>, Serializable {

    private static final long serialVersionUID = 1L;

    private Class<?> entityClass;

    public GetTableNameCmd(Class<?> entityClass) {
        this.entityClass = entityClass;
    }

    @Override
    public String execute(CommandContext commandContext) {
        if (entityClass == null) {
            throw new FlowableIllegalArgumentException("entityClass is null");
        }

        String databaseTablePrefix = getDbSqlSession(commandContext).getDbSqlSessionFactory().getDatabaseTablePrefix();
        String tableName = EntityToTableMap.getTableName(entityClass);

        return databaseTablePrefix + tableName;
    }

}

View on GitHub (pinned to d6d39ce1c6)