{"record":{"id":"f5a8880f6fec9014","repo":"pinpoint-apm/pinpoint","slug":"jarfile-create-error","errorCode":null,"errorMessage":" JarFile create error ","messagePattern":" JarFile create error ","errorType":"exception","errorClass":"PluginException","httpStatus":null,"severity":"error","filePath":"agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/plugin/PluginJar.java","lineNumber":65,"sourceCode":"        this.jarFile = createJarFile(path);\n        this.manifest = PluginManifest.of(jarFile);\n    }\n\n\n    private URL toURL(Path file) {\n        try {\n            return file.toUri().toURL();\n        } catch (MalformedURLException e) {\n            throw new PluginException(file + \" toURL error\", e);\n        }\n    }\n\n    private static JarFile createJarFile(Path pluginJar) {\n        try {\n            verify(pluginJar);\n            return new JarFile(pluginJar.toFile());\n        } catch (IOException e) {\n            throw new PluginException(pluginJar + \" JarFile create error \" + e.getCause(), e);\n        }\n    }\n\n    public static PluginJar fromFilePath(Path path) {\n        return new PluginJar(path);\n    }\n\n    private static void verify(Path file) {\n        if (!Files.exists(file)) {\n            throw new PluginException(file + \" File does not exist\");\n        }\n        if (!Files.isRegularFile(file)) {\n            throw new PluginException(file + \" is not a file\");\n        }\n        if (!Files.isReadable(file)) {\n            throw new PluginException(file + \" File cannot be read\");\n        }\n    }","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/plugin/PluginJar.java#L47-L83","documentation":"PluginJar.createJarFile() verifies the plugin path and opens it as a JarFile. If opening throws IOException (corrupt zip, unreadable file, wrong format), it wraps it in PinpointException with 'JarFile create error'. The agent cannot load the plugin jar, so plugin loading fails at startup.","triggerScenarios":"PluginJar.fromFilePath()/new PluginJar(path) called on a path whose file passes existence checks but cannot be opened as a jar — corrupt download, non-zip file, locked file, or IO error during open.","commonSituations":"Truncated plugin jar from a failed copy/download; plugin directory containing a non-jar file; file permission or mount issues in containers; verify() passing but file changed between check and open (race).","solutions":["Verify the jar with 'jar tf <file>' or unzip -t to confirm it is a valid zip archive","Re-download/re-copy the plugin jar and retry","Ensure the plugin file is readable by the agent process user and on a stable filesystem","Catch PinpointException around plugin loading and skip/log the offending jar instead of aborting the agent"],"exampleFix":"// before\nPluginJar plugin = PluginJar.fromFilePath(Paths.get(\"/plugins/broken.jar\"));\n// after\nif (Files.isReadable(p) && isZipArchive(p)) { PluginJar plugin = PluginJar.fromFilePath(p); }","handlingStrategy":"try-catch","validationCode":"Path p = Paths.get(pluginPath);\nif (!Files.exists(p) || !Files.isRegularFile(p)) throw new IllegalArgumentException(\"not a file: \" + p);\ntry (JarFile jf = new JarFile(p.toFile())) { /* valid jar */ }\ncatch (IOException e) { throw new IllegalStateException(\"corrupt plugin jar: \" + p, e); }","typeGuard":null,"tryCatchPattern":"try {\n    PluginJar plugin = PluginJar.fromFilePath(p);\n} catch (PluginException e) {\n    logger.error(\"Cannot load plugin {}: {}\", p, e.getMessage());\n}","preventionTips":["Checksum plugin jars after download/copy","Test jars with 'jar tf' before deploying","Avoid modifying the plugins directory while the agent runs","Ensure the agent process user has read permission on plugin files"],"tags":["jar","file-io","plugin-loading"],"backgroundTag":"file-open-failed","analyzedSha":"744c3d3075e595656abb1ae331ad2c0e4c9eb996","analyzedAt":"2026-09-07T18:48:45.289Z","contentChangedAt":"2026-09-07T18:48:45.289Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}