{"record":{"id":"c1b422d2cfd3c58c","repo":"apache/pulsar","slug":"property","errorCode":null,"errorMessage":"Property ","messagePattern":"Property ","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"pulsar-functions/runtime-all/src/main/java/org/apache/pulsar/functions/instance/JavaInstanceMain.java","lineNumber":82,"sourceCode":"                    .getMethod(\"shutdown\");\n        } catch (ClassNotFoundException | NoSuchMethodException e) {\n            // ignore\n        }\n        log4j2ShutdownMethod = shutdownMethod;\n    }\n\n    public JavaInstanceMain() {\n    }\n\n    public static void main(String[] args) throws Exception {\n\n        // Set root classloader to current classpath\n        ClassLoader root = Thread.currentThread().getContextClassLoader();\n\n        // Get classpath for function instance\n        String functionInstanceClasspath = System.getProperty(FUNCTIONS_INSTANCE_CLASSPATH);\n        if (functionInstanceClasspath == null) {\n            throw new IllegalArgumentException(\"Property \" + FUNCTIONS_INSTANCE_CLASSPATH + \" is not set!\");\n        }\n\n        List<File> files = new LinkedList<>();\n        for (String entry : functionInstanceClasspath.split(\":\")) {\n            if (isBlank(entry)) {\n                continue;\n            }\n            // replace any asterisks i.e. wildcards as they don't work with url classloader\n            File f = new File(entry.replace(\"*\", \"\"));\n            if (f.exists()) {\n                if (f.isDirectory()) {\n                    files.addAll(Arrays.asList(f.listFiles()));\n                } else {\n                    files.add(new File(entry));\n                }\n            } else {\n                System.out.println(\n                        String.format(\"[WARN] %s on functions instance classpath does not exist\", f.getAbsolutePath()));","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-functions/runtime-all/src/main/java/org/apache/pulsar/functions/instance/JavaInstanceMain.java#L64-L100","documentation":"JavaInstanceMain.main() reads the JVM system property pulsar.functions.instance.classpath (FUNCTIONS_INSTANCE_CLASSPATH) to build the classloader for the function instance. If the property is absent it throws IllegalArgumentException immediately, because without it the user function's classes cannot be located.","triggerScenarios":"Launching the function instance via java org.apache.pulsar.functions.instance.JavaInstanceMain without -Dpulsar.functions.instance.classpath=... set, or a launcher script (e.g. the function runtime assembly scripts) that fails to pass it.","commonSituations":"Hand-rolled java commands instead of the provided function runner scripts; corrupted/older function worker distribution where the instance jar's startup script doesn't set the property; custom exec runtimes missing the flag.","solutions":["Launch with -Dpulsar.functions.instance.classpath set to the function instance jar(s), e.g. -Dpulsar.functions.instance.classpath=/pulsar/instances/java-instance.jar.","Use the standard pulsar function runner scripts rather than invoking JavaInstanceMain manually.","Verify the function worker distribution is complete and versions match the broker (the script that sets the property ships with it).","If using a custom runtime, set the property in the process environment before exec (the classpath is normally derived from it)."],"exampleFix":"// before\njava org.apache.pulsar.functions.instance.JavaInstanceMain ...\n// after\njava -Dpulsar.functions.instance.classpath=/pulsar/instances/java-instance.jar org.apache.pulsar.functions.instance.JavaInstanceMain ...","handlingStrategy":"validation","validationCode":"if (System.getProperty(\"pulsar.functions.instance.classpath\") == null) { throw new IllegalStateException(\"Start with -Dpulsar.functions.instance.classpath=<instance jars>\"); }","typeGuard":"null","tryCatchPattern":"try { JavaInstanceMain.main(args); } catch (IllegalArgumentException e) { if (e.getMessage().contains(\"Property\")) { System.err.println(\"Missing -Dpulsar.functions.instance.classpath; use the provided function runner script\"); } throw e; }","preventionTips":["Use Pulsar's shipped function runner scripts instead of invoking JavaInstanceMain manually.","Verify the property in your container entrypoint before exec'ing the JVM.","Keep function worker distribution complete and version-matched with the broker.","Set the property in Dockerfile/entrypoint so it cannot be forgotten."],"tags":["configuration","classpath","jvm","system-property"],"backgroundTag":"missing-env-var","analyzedSha":"820761864ed8e2a7d2e52dd9763ad2ae117c1395","analyzedAt":"2026-09-06T00:14:20.138Z","contentChangedAt":"2026-09-06T00:14:20.138Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}