pinpoint-apm/pinpoint · info

Failed to close JarFile:

Error message

Failed to close JarFile:

What it means

After appending boot jars to the bootstrap class loader, the code closes each opened JarFile in a finally block; if closing one fails the exception is logged as this warning. Instrumentation continues; this indicates a leaked/locked jar handle or filesystem oddity, not a failed load.

Solutions

  1. Generally safe to ignore — the agent proceeds; verify the agent started normally afterwards
  2. On Windows, exclude the agent directory from antivirus scanning
  3. Avoid replacing/deleting agent jars while the JVM is running
  4. If it recurs, check for duplicate boot jar entries in the agent's boot directory
Defensive patterns

Strategy: retry

Prevention

When it happens

Trigger: JarFile.close() throws due to OS-level file locking (Windows), an already-closed handle, or the jar file being deleted/moved while the JVM holds it open.

Common situations: Running on Windows with antivirus or another process holding the jar; agent directory swapped while the JVM is starting; duplicated jar handles opened during appendToBootstrapClassLoader.

Understand the failure class

Background: "open() failed", "failed to open file", "cannot create file" — what a file open error means and how to fix it — this error's family across 42 libraries.

Related errors


AI-assisted analysis of pinpoint-apm/pinpoint@744c3d3075 (2026-09-07). Data as JSON: /api/errors/2352b3169b37a39a. Report an issue: GitHub.

Appendix: source

Thrown at agent-module/bootstraps/bootstrap/src/main/java/com/navercorp/pinpoint/bootstrap/PinpointBootStrap.java:160

            logger.info("agentParameter:" + agentArgs);
        }
        return agentArgsMap;
    }

    private void appendToBootstrapClassLoader(Instrumentation instrumentation, BootDir bootDir) {
        List<JarFile> jarFiles = bootDir.openJarFiles();
        try {
            for (JarFile jarFile : jarFiles) {
                Path path = FileUtils.subpathAfterLast(Paths.get(jarFile.getName()), 2);
                logger.info("appendToBootstrapClassLoader:" + path);
                instrumentation.appendToBootstrapClassLoaderSearch(jarFile);
            }
        } finally {
            for (JarFile jarFile : jarFiles) {
                try {
                    jarFile.close();
                } catch (Exception e) {
                    logger.warn("Failed to close JarFile:" + jarFile.getName(), e);
                }
            }
        }
    }


    private static void logPinpointAgentLoadFail() {
        final String errorLog =
                "*****************************************************************************\n" +
                        "* Pinpoint Agent load failure\n" +
                        "*****************************************************************************";
        System.err.println(errorLog);
    }


}

View on GitHub (pinned to 744c3d3075)