{"record":{"id":"44ade6211d17d6fe","repo":"zhisheng17/flink-learning","slug":"only-local-is-supported-as-schema-for-applicatio","errorCode":null,"errorMessage":"Only \"local\" is supported as schema for application mode. This assumes that the jar is located in the image, not the Flink client. An example of such path is: local:///opt/flink/examples/streaming/WindowJoin.jar","messagePattern":"Only \"local\" is supported as schema for application mode\\. This assumes that the jar is located in the image, not the Flink client\\. An example of such path is: local:///opt/flink/examples/streaming/WindowJoin\\.jar","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"flink-learning-k8s/flink-k8s/src/main/java/org/apache/flink/kubernetes/utils/KubernetesUtils.java","lineNumber":366,"sourceCode":"\t\tstartCommandValues.put(\"logging\",\n\t\t\tgetLogging(logDirectory + \"/\" + fileName, configDirectory, hasLogback, hasLog4j));\n\t\tstartCommandValues.put(\"class\", mainClass);\n\n\t\tstartCommandValues.put(\"args\", mainArgs != null ? mainArgs : \"\");\n\n\t\tfinal String commandTemplate = flinkConfig.getString(KubernetesConfigOptions.CONTAINER_START_COMMAND_TEMPLATE);\n\t\treturn BootstrapTools.getStartCommand(commandTemplate, startCommandValues);\n\t}\n\n\tpublic static List<File> checkJarFileForApplicationMode(Configuration configuration) {\n\t\treturn configuration.get(PipelineOptions.JARS).stream().map(\n\t\t\tFunctionUtils.uncheckedFunction(\n\t\t\t\turi -> {\n\t\t\t\t\tfinal URI jarURI = PackagedProgramUtils.resolveURI(uri);\n\t\t\t\t\tif (jarURI.getScheme().equals(\"local\") && jarURI.isAbsolute()) {\n\t\t\t\t\t\treturn new File(jarURI.getPath());\n\t\t\t\t\t}\n\t\t\t\t\tthrow new IllegalArgumentException(\"Only \\\"local\\\" is supported as schema for application mode.\" +\n\t\t\t\t\t\t\t\" This assumes that the jar is located in the image, not the Flink client.\" +\n\t\t\t\t\t\t\t\" An example of such path is: local:///opt/flink/examples/streaming/WindowJoin.jar\");\n\t\t\t\t})\n\t\t).collect(Collectors.toList());\n\t}\n\n\tprivate static String getJavaOpts(Configuration flinkConfig, ConfigOption<String> configOption) {\n\t\tString baseJavaOpts = flinkConfig.getString(CoreOptions.FLINK_JVM_OPTIONS);\n\n\t\tif (flinkConfig.getString(configOption).length() > 0) {\n\t\t\treturn baseJavaOpts + \" \" + flinkConfig.getString(configOption);\n\t\t} else {\n\t\t\treturn baseJavaOpts;\n\t\t}\n\t}\n\n\tprivate static String getLogging(String fileName, String confDir, boolean hasLogback, boolean hasLog4j) {\n\t\tStringBuilder logging = new StringBuilder();","sourceCodeStart":348,"sourceCodeEnd":384,"githubUrl":"https://github.com/zhisheng17/flink-learning/blob/d731cee7618021be56d132cc925102ffff8d75e6/flink-learning-k8s/flink-k8s/src/main/java/org/apache/flink/kubernetes/utils/KubernetesUtils.java#L348-L384","documentation":"KubernetesUtils.checkJarFileForApplicationMode validates the user jar URI when running in Kubernetes application mode. Only 'local://' scheme URIs are accepted because the jar must be baked into the container image, not fetched from the client machine; any other scheme throws this IllegalArgumentException.","triggerScenarios":"Submitting with -t kubernetes-application and a jar argument like /path/to/job.jar, file:///path/job.jar, or http://.../job.jar instead of local:///path/in/image/job.jar.","commonSituations":"Reusing a client-mode submission command unchanged for application mode, or forgetting to COPY the jar into the custom image while pointing at the local filesystem path.","solutions":["Change the jar argument to local:///<path-inside-image>, e.g. local:///opt/flink/usrlib/job.jar.","COPY the jar into the image at that path (e.g. under /opt/flink/usrlib/) and rebuild the image.","Use session or per-job mode instead if you need to upload a local jar from the client."],"exampleFix":"// before\n./bin/flink run -t kubernetes-application -c MainClass /home/me/job.jar\n// after (with jar at /opt/flink/usrlib/job.jar in the image)\n./bin/flink run -t kubernetes-application -c MainClass local:///opt/flink/usrlib/job.jar","handlingStrategy":"validation","validationCode":"URI uri = PackagedProgramUtils.resolveURI(jarArg);\nif (!(\"local\".equals(uri.getScheme()) && uri.isAbsolute())) {\n    throw new IllegalArgumentException(\"Application mode jar must use local:/// scheme: \" + jarArg);\n}","typeGuard":null,"tryCatchPattern":"try {\n    KubernetesUtils.checkJarFileForApplicationMode(flinkConfig);\n} catch (IllegalArgumentException e) {\n    LOG.error(\"Application mode requires local:/// jar inside the image: {}\", e.getMessage());\n}","preventionTips":["Always use local:///<path-inside-image> for application mode jar arguments.","COPY the user jar into the image (e.g. /opt/flink/usrlib/) and verify it exists.","Keep separate submission scripts for session vs application mode."],"tags":["kubernetes","application-mode","jar-uri"],"backgroundTag":"invalid-url-format","analyzedSha":"d731cee7618021be56d132cc925102ffff8d75e6","analyzedAt":"2026-09-06T05:35:08.496Z","contentChangedAt":"2026-09-06T05:35:08.496Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}