{"record":{"id":"bed408e3e0e380d0","repo":"quarkusio/quarkus","slug":"classpath-resource-path-not-found-for-micr","errorCode":null,"errorMessage":"Classpath resource \" + path + \" not found for MicroProfile Rest Client SSL configuration","messagePattern":"Classpath resource \" \\+ path \\+ \" not found for MicroProfile Rest Client SSL configuration","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions/resteasy-reactive/rest-client/runtime/src/main/java/io/quarkus/rest/client/reactive/runtime/RestClientCDIDelegateBuilder.java","lineNumber":363,"sourceCode":"                throw new IllegalArgumentException(\"Failed to initialize trust store from classpath resource \" + trustStorePath,\n                        e);\n            }\n\n            builder.trustStore(trustStore, password);\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    private void configureProviders(QuarkusRestClientBuilder builder) {\n        Optional<String> maybeProviders = oneOf(restClientConfig.providers(), configRoot.providers());","sourceCodeStart":345,"sourceCodeEnd":381,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/resteasy-reactive/rest-client/runtime/src/main/java/io/quarkus/rest/client/reactive/runtime/RestClientCDIDelegateBuilder.java#L345-L381","documentation":"Thrown by RestClientCDIDelegateBuilder.locateStream when an SSL keystore/truststore path configured with the 'classpath:' scheme cannot be resolved as a resource on the classpath. Both the thread-context classloader and the builder class loader were tried and returned null, so Quarkus fails fast rather than silently starting the client without SSL material.","triggerScenarios":"A @RegisterRestClient interface (or quarkus.rest-client.<config-key> properties) sets quarkus.rest-client.<key>.trust-store or key-store (or mp.rest-client equivalents) to 'classpath:some/path.p12' but the resource is missing from the packaged artifact; registerKeyStore/registerTrustStore invoke locateStream and getResourceAsStream returns null for both loaders.","commonSituations":"The PEM/PKCS12 file lives in src/main/resources but was excluded by build resource filtering or a .gitignore; the file is present in a test module but not in the dependency jar the app actually packages; path typo or wrong package directory (e.g. 'certs/keystore.p12' when the file is at resources root); a library relocation moved the resource to a different module; running in native mode where the resource was not included.","solutions":["Put the keystore/truststore file under src/main/resources at exactly the path given after 'classpath:' (e.g. classpath:ssl/keystore.p12 -> src/main/resources/ssl/keystore.p12) and rebuild","Check the packaged jar/runner: unzip target/quarkus-app/quarkus-run.jar (or the artifact jar) and verify the resource exists; adjust path or Maven resource includes accordingly","Use an absolute filesystem path with 'file:' scheme instead of classpath: if the certificate is provisioned externally (e.g. mounted secret)","Verify the classloader visibility: in tests, ensure the resource is on the test classpath of the module running the test","If in native mode, confirm the resource is bundled (Quarkus includes classpath resources by default; check quarkus.native.resources.includes if needed)"],"exampleFix":"// before (application.properties)\nquarkus.rest-client.myservice.key-store=classpath:keys/keystore.p12\n// after (file actually moved to resources root)\nquarkus.rest-client.myservice.key-store=classpath:keystore.p12\n// or use a file path:\nquarkus.rest-client.myservice.key-store=file:/etc/certs/keystore.p12","handlingStrategy":"validation","validationCode":"String path = configValue.replaceFirst(\"classpath:\", \"\");\nif (Thread.currentThread().getContextClassLoader().getResource(path) == null) {\n    throw new IllegalStateException(\"Keystore resource missing from classpath: \" + path);\n}","typeGuard":null,"tryCatchPattern":"try {\n    MyClient client = Arc.container().instance(MyClient.class).get();\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"Classpath resource\")) {\n        throw new ConfigurationException(\"Fix quarkus.rest-client key-store/trust-store classpath path\", e);\n    }\n    throw e;\n}","preventionTips":["Keep certificate files in src/main/resources and reference them with exact 'classpath:<resource-path>' values","After adding a cert, verify it appears in the built jar before deploying","Add a startup test that opens the keystore resource from the classpath","Prefer 'file:' absolute paths for externally provisioned certs and 'classpath:' only for bundled ones"],"tags":["ssl","rest-client","classpath","configuration","microprofile"],"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"}