{"record":{"id":"0e99d1e7546410d5","repo":"flowable/flowable-engine","slug":"class-or-class-name-is-missing-0e99d1","errorCode":null,"errorMessage":"Class or class name is missing","messagePattern":"Class or class name is missing","errorType":"exception","errorClass":"de.odysseus.el.tree.impl.el.ELException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/scripting/JuelScriptEngine.java","lineNumber":230,"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 (ActivitiException 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":212,"sourceCodeEnd":248,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/scripting/JuelScriptEngine.java#L212-L248","documentation":"JuelScriptEngine.importFunctions registers static methods of a class as EL functions. It accepts either a Class object or a class name String in the passed map/argument; if the value is neither (e.g. null or another type) it throws an ELException stating the class or class name is missing.","triggerScenarios":"Calling JuelScriptEngine.importFunctions with a functions map entry whose value is not a Class and not a String class name (null, Integer, etc.), so neither ReflectUtil.loadClass path nor the Class branch is taken.","commonSituations":"Custom scripting bindings configured with a wrong type, reflection-based registration where the class constant failed to resolve to null, copying a function-import configuration from another engine that used a different value format.","solutions":["Pass a Class object (e.g. MyUtils.class) or a fully qualified class name String as the function-import value.","Check the configured value for typos or missing initialization that left it null.","Log/inspect the offending value type before calling importFunctions and fail with a clearer message.","If the class name String is failing due to loadClass, note that failure surfaces as ELException wrapping ActivitiException — fix the classpath instead."],"exampleFix":"// before\nfunctions.put(\"math\", null);\nengine.importFunctions(functions);\n// after\nfunctions.put(\"math\", java.lang.Math.class);\nengine.importFunctions(functions);","handlingStrategy":"type-guard","validationCode":"Object val = functions.get(\"math\");\nif (!(val instanceof Class) && !(val instanceof String)) {\n    throw new IllegalArgumentException(\"function import needs Class or class-name String\");\n}","typeGuard":"boolean isValidFunctionTarget(Object v) {\n    return v instanceof Class || (v instanceof String && !((String) v).isEmpty());\n}","tryCatchPattern":"try {\n    engine.importFunctions(functions);\n} catch (ELException e) {\n    throw new ScriptConfigException(\"bad function import entry\", e);\n}","preventionTips":["Always register function imports with Class literals, not reflection results that may be null.","Log the map contents when configuring scripting function imports."],"tags":["scripting","juel","class-not-found","type-mismatch"],"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"}