{"record":{"id":"cccf9a36cf6f2bdb","repo":"quarkusio/quarkus","slug":"classpath-resource-path-not-found-for-microprof","errorCode":null,"errorMessage":"Classpath resource ${path} not found for MicroProfile Rest Client SSL configuration","messagePattern":"Classpath resource (.+?) not found for MicroProfile Rest Client SSL configuration","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions/resteasy-classic/resteasy-client/runtime/src/main/java/io/quarkus/restclient/runtime/RestClientBase.java","lineNumber":227,"sourceCode":"                throw new IllegalArgumentException(\"Failed to initialize trust store from classpath resource \" + trustStorePath,\n                        e);\n            }\n\n            builder.trustStore(trustStore);\n        } catch (KeyStoreException e) {\n            throw new IllegalArgumentException(\"Failed to initialize trust store from \" + trustStorePath, e);\n        }\n    }\n\n    private InputStream locateStream(String path) throws FileNotFoundException {\n        if (path.startsWith(\"classpath:\")) {\n            path = path.replaceFirst(\"classpath:\", \"\");\n            InputStream resultStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(path);\n            if (resultStream == null) {\n                resultStream = getClass().getResourceAsStream(path);\n            }\n            if (resultStream == null) {\n                throw new IllegalArgumentException(\n                        \"Classpath resource \" + path + \" not found for MicroProfile Rest Client SSL configuration\");\n            }\n            return resultStream;\n        } else {\n            if (path.startsWith(\"file:\")) {\n                path = path.replaceFirst(\"file:\", \"\");\n            }\n            File certificateFile = new File(path);\n            if (!certificateFile.isFile()) {\n                throw new IllegalArgumentException(\n                        \"Certificate file: \" + path + \" not found for MicroProfile Rest Client SSL configuration\");\n            }\n            return new FileInputStream(certificateFile);\n        }\n    }\n\n    protected void configureProviders(RestClientBuilder builder) {\n        Optional<String> providers = oneOf(restClientConfig.providers(), configRoot.providers());","sourceCodeStart":209,"sourceCodeEnd":245,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/resteasy-classic/resteasy-client/runtime/src/main/java/io/quarkus/restclient/runtime/RestClientBase.java#L209-L245","documentation":"RestClientBase.locateStream() resolves classpath: URLs for keystore/truststore paths. It tries the thread context ClassLoader then the class's own ClassLoader, and throws this IllegalArgumentException when neither can open the resource — the file is not on the application classpath under that exact path.","triggerScenarios":"quarkus.rest-client.<key>.trust-store or keystore value starts with 'classpath:' but no resource exists at the remaining path in the runtime classloader (e.g. classpath:certs/truststore.jks with no src/main/resources/certs/truststore.jks).","commonSituations":"File placed in src/test/resources only; leading slash mismatch (classpath:/x vs classpath:x); resource in a different module not declared as a dependency; packaged inside a jar but excluded by packaging config.","solutions":["Move the file into src/main/resources at the exact path referenced","Align the path spelling: classpath:certs/truststore.jks, matching the actual resource location and slash usage","Verify at runtime with getClass().getResourceAsStream(\"/certs/truststore.jks\") before startup","Prefer file: paths for stores living outside the artifact (e.g. /etc/certs/) to avoid packaging issues"],"exampleFix":"// before (application.properties)\nquarkus.rest-client.payment.trust-store=classpath:/certs/truststore.jks\n// after — file actually at src/main/resources/certs/truststore.jks\nquarkus.rest-client.payment.trust-store=classpath:certs/truststore.jks","handlingStrategy":"validation","validationCode":"// fail fast if the classpath resource is absent\nString path = \"certs/truststore.jks\";\nif (getClass().getClassLoader().getResourceAsStream(path) == null) {\n    throw new IllegalStateException(\"Missing classpath resource: \" + path);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Commit keystores under src/main/resources at the exact path configured","Do not add a leading slash to classpath: paths in this config","Add an ApplicationStarted observer that resolves all configured SSL resources","List the final jar contents in CI to verify resource inclusion"],"tags":["classpath","resource-not-found","ssl","rest-client"],"backgroundTag":"classpath-resource-not-found","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}