pinpoint-apm/pinpoint · error · IllegalArgumentException

not found

Error message

 not found

What it means

JarFileUtils.openJarFile(Path) validates its argument before opening a JAR. If Files.exists(path) is false it throws IllegalArgumentException with "<path> not found". It is a precondition check so callers get a clear message instead of an obscure JarFile/IOException later.

Source

Thrown at agent-module/bootstraps/bootstrap/src/main/java/com/navercorp/pinpoint/bootstrap/agentdir/JarFileUtils.java:34

package com.navercorp.pinpoint.bootstrap.agentdir;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Objects;
import java.util.jar.JarFile;

/**
 * @author Woonduk Kang(emeroad)
 */
final class JarFileUtils {

    public static JarFile openJarFile(Path path) {
        Objects.requireNonNull(path, "path");

        if (!Files.exists(path)) {
            throw new IllegalArgumentException(path + " not found");
        }
        if (Files.isDirectory(path)) {
            throw new IllegalArgumentException(path + " is directory");
        }
        if (!Files.isRegularFile(path)) {
            throw new IllegalArgumentException(path + " not file");
        }
        if (!Files.isReadable(path)) {
            throw new IllegalArgumentException(path + " can read");
        }
        try {
            return new JarFile(path.toFile());
        } catch (IOException e) {
            throw new IllegalStateException(path + " create fail Caused by:" + e.getMessage(), e);
        }
    }
}

View on GitHub (pinned to 744c3d3075)

Solutions

  1. Check the exact path exists before opening: `ls -l <path>` or Files.exists(path).
  2. Fix the caller to pass the resolved absolute path (path.toAbsolutePath()) of an actual JAR.
  3. If the JAR was legitimately removed, refresh the list of candidate JARs instead of keeping stale entries.
  4. Correct the file name/path in configuration to match the deployed JAR.

Example fix

// before
JarFile jar = JarFileUtils.openJarFile(Paths.get("plugins", "my-plugin.jar")); // may not exist
// after
Path p = Paths.get("plugins", "my-plugin.jar").toAbsolutePath();
if (Files.exists(p)) {
    JarFile jar = JarFileUtils.openJarFile(p);
}
Defensive patterns

Strategy: validation

Validate before calling

Path p = candidate.toAbsolutePath();
if (!Files.exists(p)) {
    throw new IllegalArgumentException("JAR does not exist: " + p);
}

Try / catch

try {
    JarFile jar = JarFileUtils.openJarFile(path);
} catch (IllegalArgumentException e) {
    logger.warn("Skipping unavailable JAR {}: {}", path, e.getMessage());
}

Prevention

When it happens

Trigger: Calling JarFileUtils.openJarFile(path) with a path that does not exist on disk — file was deleted/moved, the path string is wrong, or the parent directory was resolved relative to an unexpected working directory.

Common situations: Plugin/agent JAR removed after startup enumeration (stale path in a list); misspelled JAR file name in configuration; relative paths resolved against a different process working directory; deployment packaging that omitted the JAR.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


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