pinpoint-apm/pinpoint · error · IOException

classPath not found. classPath:+classPath

Error message

classPath not found. classPath:+classPath

What it means

PropertyUtils.loadPropertyFromClassPath loads a .properties file from the classpath. If the classloader cannot find the given resource path, an IOException('classPath not found...') is thrown so missing resources surface as I/O failures rather than silent null properties.

Source

Thrown at commons/src/main/java/com/navercorp/pinpoint/common/util/PropertyUtils.java:52

    private PropertyUtils() {
    }

    public static Properties loadProperty(final InputStream inputStream) throws IOException {
        Objects.requireNonNull(inputStream, "inputStream");

        return loadProperty(new Properties(), inputStream, UTF_8);
    }



    public static Properties loadPropertyFromClassPath(final String classPath) throws IOException {
        Objects.requireNonNull(classPath, "classPath");

        ClassLoader cl = ClassLoaderUtils.getDefaultClassLoader(PropertyUtils.class::getClassLoader);
        InputStream inputStream = cl.getResourceAsStream(classPath);
        if (inputStream == null) {
            throw new IOException("classPath not found. classPath:" + classPath);
        }
        return loadProperty(new Properties(), inputStream, UTF_8);
    }


    public static Properties loadProperty(Properties properties, InputStream inputStream, Charset encoding) throws IOException {
        Objects.requireNonNull(properties, "properties");
        Objects.requireNonNull(inputStream, "inputStream");
        Objects.requireNonNull(encoding, "encoding");

        Reader reader = null;
        try {
            reader = new InputStreamReader(inputStream, encoding);
            properties.load(reader);
        } finally {
            IOUtils.closeQuietly(reader);
            IOUtils.closeQuietly(inputStream);
        }

View on GitHub (pinned to 744c3d3075)

Solutions

  1. Verify the exact classpath path matches a resource under src/main/resources
  2. Check the resource is packaged in the jar (unzip -l app.jar | grep path)
  3. Fix build config so the resource is not excluded or filtered away
  4. Provide the file in the classpath or fall back to a default property set

Example fix

// before
Properties p = PropertyUtils.loadPropertyFromClassPath("pinpoint.config"); // not on classpath
// after
String path = "/pinpoint.config";
if (PropertyUtils.class.getResourceAsStream(path) == null) {
    throw new IllegalStateException("Missing classpath resource: " + path);
}
Properties p = PropertyUtils.loadPropertyFromClassPath(path);
Defensive patterns

Strategy: try-catch

Validate before calling

InputStream probe = Thread.currentThread().getContextClassLoader().getResourceAsStream(classPath);
if (probe == null) throw new IOException("Resource missing on classpath: " + classPath);
Properties props = PropertyUtils.loadPropertyFromClassPath(classPath);

Type guard

boolean resourceExists(String path) {
    return Thread.currentThread().getContextClassLoader().getResource(path) != null;
}

Try / catch

try {
    props = PropertyUtils.loadPropertyFromClassPath(classPath);
} catch (IOException e) {
    logger.error("Classpath resource not found: {}", classPath, e);
    props = new Properties(); // or fail fast
}

Prevention

When it happens

Trigger: Calling loadPropertyFromClassPath("some/path.properties") when the resource is absent from the jar/classpath, the path is misspelled, or the file was excluded from the build.

Common situations: Typo in resource path or missing leading convention; resource not included by build plugin (filtering/exclusion); packaging changed between versions so the file moved.

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/17d2f2a6ce79ca61. Report an issue: GitHub.