{"record":{"id":"31865e6fadd0fe2f","repo":"flowable/flowable-engine","slug":"class-or-class-name-is-missing","errorCode":null,"errorMessage":"Class or class name is missing","messagePattern":"Class or class name is missing","errorType":"exception","errorClass":"ELException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/scripting/JuelScriptEngine.java","lineNumber":232,"sourceCode":"            return JuelScriptEngine.class.getMethod(\"importFunctions\", new Class[] { ScriptContext.class, String.class, Object.class });\n        } catch (Exception exp) {\n            // Will never occur\n            return null;\n        }\n    }\n\n    public static void importFunctions(ScriptContext ctx, String namespace, Object obj) {\n        Class<?> clazz = null;\n        if (obj instanceof Class) {\n            clazz = (Class<?>) obj;\n        } else if (obj instanceof String) {\n            try {\n                clazz = ReflectUtil.loadClass((String) obj);\n            } catch (FlowableException ae) {\n                throw new ELException(ae);\n            }\n        } else {\n            throw new ELException(\"Class or class name is missing\");\n        }\n        Method[] methods = clazz.getMethods();\n        for (Method m : methods) {\n            int mod = m.getModifiers();\n            if (Modifier.isStatic(mod) && Modifier.isPublic(mod)) {\n                String name = namespace + \":\" + m.getName();\n                ctx.setAttribute(name, m, ScriptContext.ENGINE_SCOPE);\n            }\n        }\n    }\n\n    /**\n     * Class representing a compiled script using JUEL.\n     * \n     * @author Frederik Heremans\n     */\n    private class JuelCompiledScript extends CompiledScript {\n","sourceCodeStart":214,"sourceCodeEnd":250,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/scripting/JuelScriptEngine.java#L214-L250","documentation":"javax.el.ELException thrown by JuelScriptEngine.importFunctions when the value registered for a function importer is neither a Class, an object instance, nor a String class name loadable by ReflectUtil.loadClass. The engine needs a class to enumerate its static public methods as EL functions.","triggerScenarios":"Calling juelScriptEngine.importFunctions(scope, namespace, obj) where obj is an unexpected type (e.g. a primitive wrapper, a List of classes, or an arbitrary object that is not a Class and not a class-name String).","commonSituations":"Custom script engine configuration passing a misconfigured bean into the function importer; loading classes from a script where the class reference resolved to something other than a Class/String; typos or refactors in custom scripting setup.","solutions":["Pass either a java.lang.Class object, an object instance whose class is used, or a fully qualified class name String to importFunctions.","Verify the class name String is on the classpath so ReflectUtil.loadClass succeeds (a failed load raises ELException wrapping FlowableException).","Log the actual type of the imported value before registration to catch wrong objects early."],"exampleFix":"// before\nengine.importFunctions(scope, \"fn\", Arrays.asList(Math.class));\n\n// after\nengine.importFunctions(scope, \"fn\", Math.class);","handlingStrategy":"type-guard","validationCode":"if (!(obj instanceof Class) && !(obj instanceof String) && obj == null) {\n    throw new IllegalArgumentException(\"importFunctions expects a Class or class-name String\");\n}","typeGuard":"boolean isImportable(Object o) {\n    return o instanceof Class || o instanceof String;\n}","tryCatchPattern":"try {\n    engine.importFunctions(scope, ns, obj);\n} catch (ELException e) {\n    log.error(\"failed to import functions from {}: {}\", obj, e.getMessage());\n}","preventionTips":["Only pass Class objects or FQCN strings to importFunctions","Verify class is on the classpath with ReflectUtil.loadClass in tests","Log the runtime type of configured function importer objects"],"tags":["flowable","scripting","juel","el-exception"],"backgroundTag":"invalid-argument-value","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}