{"record":{"id":"17d2f2a6ce79ca61","repo":"pinpoint-apm/pinpoint","slug":"classpath-not-found-classpath-classpath","errorCode":null,"errorMessage":"classPath not found. classPath:+classPath","messagePattern":"classPath not found\\. classPath:\\+classPath","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"commons/src/main/java/com/navercorp/pinpoint/common/util/PropertyUtils.java","lineNumber":52,"sourceCode":"\r\n    private PropertyUtils() {\r\n    }\r\n\r\n    public static Properties loadProperty(final InputStream inputStream) throws IOException {\r\n        Objects.requireNonNull(inputStream, \"inputStream\");\r\n\r\n        return loadProperty(new Properties(), inputStream, UTF_8);\r\n    }\r\n\r\n\r\n\r\n    public static Properties loadPropertyFromClassPath(final String classPath) throws IOException {\r\n        Objects.requireNonNull(classPath, \"classPath\");\r\n\r\n        ClassLoader cl = ClassLoaderUtils.getDefaultClassLoader(PropertyUtils.class::getClassLoader);\r\n        InputStream inputStream = cl.getResourceAsStream(classPath);\r\n        if (inputStream == null) {\r\n            throw new IOException(\"classPath not found. classPath:\" + classPath);\r\n        }\r\n        return loadProperty(new Properties(), inputStream, UTF_8);\r\n    }\r\n\r\n\r\n    public static Properties loadProperty(Properties properties, InputStream inputStream, Charset encoding) throws IOException {\r\n        Objects.requireNonNull(properties, \"properties\");\r\n        Objects.requireNonNull(inputStream, \"inputStream\");\r\n        Objects.requireNonNull(encoding, \"encoding\");\r\n\r\n        Reader reader = null;\r\n        try {\r\n            reader = new InputStreamReader(inputStream, encoding);\r\n            properties.load(reader);\r\n        } finally {\r\n            IOUtils.closeQuietly(reader);\r\n            IOUtils.closeQuietly(inputStream);\r\n        }\r","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/commons/src/main/java/com/navercorp/pinpoint/common/util/PropertyUtils.java#L34-L70","documentation":"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.","triggerScenarios":"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.","commonSituations":"Typo in resource path or missing leading convention; resource not included by build plugin (filtering/exclusion); packaging changed between versions so the file moved.","solutions":["Verify the exact classpath path matches a resource under src/main/resources","Check the resource is packaged in the jar (unzip -l app.jar | grep path)","Fix build config so the resource is not excluded or filtered away","Provide the file in the classpath or fall back to a default property set"],"exampleFix":"// before\nProperties p = PropertyUtils.loadPropertyFromClassPath(\"pinpoint.config\"); // not on classpath\n// after\nString path = \"/pinpoint.config\";\nif (PropertyUtils.class.getResourceAsStream(path) == null) {\n    throw new IllegalStateException(\"Missing classpath resource: \" + path);\n}\nProperties p = PropertyUtils.loadPropertyFromClassPath(path);","handlingStrategy":"try-catch","validationCode":"InputStream probe = Thread.currentThread().getContextClassLoader().getResourceAsStream(classPath);\nif (probe == null) throw new IOException(\"Resource missing on classpath: \" + classPath);\nProperties props = PropertyUtils.loadPropertyFromClassPath(classPath);","typeGuard":"boolean resourceExists(String path) {\n    return Thread.currentThread().getContextClassLoader().getResource(path) != null;\n}","tryCatchPattern":"try {\n    props = PropertyUtils.loadPropertyFromClassPath(classPath);\n} catch (IOException e) {\n    logger.error(\"Classpath resource not found: {}\", classPath, e);\n    props = new Properties(); // or fail fast\n}","preventionTips":["Match resource paths exactly (case-sensitive, leading slash rules)","Verify resources are packaged in the jar after build changes","Check Maven/Gradle resource filtering and exclusion settings"],"tags":["io","classpath","resource-not-found","configuration"],"backgroundTag":"file-not-found","analyzedSha":"744c3d3075e595656abb1ae331ad2c0e4c9eb996","analyzedAt":"2026-09-07T18:48:45.289Z","contentChangedAt":"2026-09-07T18:48:45.289Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}