{"record":{"id":"5b2ab23e06ea2fb3","repo":"quarkusio/quarkus","slug":"security-provider-s-can-not-be-registered","errorCode":null,"errorMessage":"Security provider %s can not be registered","messagePattern":"Security provider (.+?) can not be registered","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"critical","filePath":"extensions/security/runtime/src/main/java/io/quarkus/security/runtime/SecurityProviderUtils.java","lineNumber":60,"sourceCode":"\n    public static void insertProvider(Provider provider, int index) {\n        try {\n            if (Security.getProvider(provider.getName()) == null) {\n                Security.insertProviderAt(provider, index);\n            }\n        } catch (Exception t) {\n            final String errorMessage = String.format(\"Security provider %s can not be inserted\", provider.getName());\n            throw new ConfigurationException(errorMessage, t);\n        }\n    }\n\n    public static Provider loadProvider(String providerClassName) {\n        try {\n            return (Provider) Thread.currentThread().getContextClassLoader().loadClass(providerClassName)\n                    .getDeclaredConstructor().newInstance();\n        } catch (Exception t) {\n            final String errorMessage = String.format(\"Security provider %s can not be registered\", providerClassName);\n            throw new ConfigurationException(errorMessage, t);\n        }\n    }\n\n    public static Provider loadProviderWithParams(String providerClassName, Class<?>[] paramClasses, Object[] params) {\n        try {\n            Constructor<?> c = Thread.currentThread().getContextClassLoader().loadClass(providerClassName)\n                    .getConstructor(paramClasses);\n            return (Provider) c.newInstance(params);\n        } catch (Exception t) {\n            final String errorMessage = String.format(\"Security provider %s can not be registered\", providerClassName);\n            throw new ConfigurationException(errorMessage, t);\n        }\n    }\n\n    public static int findProviderIndex(String providerName) {\n        Provider[] providers = Security.getProviders();\n        for (int i = 0; i < providers.length; i++) {\n            if (providerName.equals(providers[i].getName())) {","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/security/runtime/src/main/java/io/quarkus/security/runtime/SecurityProviderUtils.java#L42-L78","documentation":"Thrown by SecurityProviderUtils.loadProvider when a configured security provider class (e.g. via quarkus.security.security-providers) cannot be loaded or instantiated. The class is loaded via the thread context loader, instantiated with its no-arg constructor, and cast to java.security.Provider; any failure in that chain is wrapped in a Quarkus ConfigurationException. It is a build/startup-time failure, so the application fails fast.","triggerScenarios":"quarkus.security.security-providers lists a class name that does not exist, is not on the runtime classpath (missing BouncyCastle/other provider dependency), has no public no-arg constructor, or its constructor throws (e.g. native-image restrictions, bad provider self-check).","commonSituations":"Typo in provider class name (org.bouncycastle.jce.provider.BouncyCastleProvider misspelled); forgot to add the bcprov/bcpkix dependency; provider class present in deployment but not runtime module; GraalVM native image where the provider is not registered for reflection.","solutions":["Verify the fully-qualified provider class name for typos (e.g. org.bouncycastle.jce.provider.BouncyCastleProvider)","Add the provider artifact as a runtime dependency (e.g. org.bouncycastle:bcprov-jdk18on)","Confirm the provider has a public no-arg constructor; if it needs parameters use loadProviderWithParams / quarkus.security.security-provider-params instead","For native builds, register the provider class for reflection or add it via quarkus.native.additional-build-args / runtime reinitialization","Check the wrapped cause 't' in the exception stack trace for the actual load/instantiation failure"],"exampleFix":"// before (pom.xml missing provider)\nquarkus.security.security-providers=org.bouncycastle.jce.provider.BouncyCastleProvider\n// after\n<dependency>\n  <groupId>org.bouncycastle</groupId>\n  <artifactId>bcprov-jdk18on</artifactId>\n</dependency>\nquarkus.security.security-providers=org.bouncycastle.jce.provider.BouncyCastleProvider","handlingStrategy":"validation","validationCode":"String cls = \"org.bouncycastle.jce.provider.BouncyCastleProvider\";\ntry {\n  Class<?> c = Thread.currentThread().getContextClassLoader().loadClass(cls);\n  c.getDeclaredConstructor().setAccessible(true);\n  if (!java.security.Provider.class.isAssignableFrom(c)) throw new IllegalStateException(cls + \" is not a Provider\");\n} catch (ClassNotFoundException | NoSuchMethodException e) {\n  throw new IllegalStateException(\"Provider missing or lacks no-arg ctor: \" + cls, e);\n}","typeGuard":null,"tryCatchPattern":"try {\n  SecurityProviderUtils.loadProvider(providerClassName);\n} catch (ConfigurationException e) {\n  log.errorf(e.getCause(), \"Cannot load security provider %s\", providerClassName);\n  throw new IllegalStateException(\"Fix quarkus.security.security-providers entry/dependency\", e);\n}","preventionTips":["Keep provider class names in a constant and test-load them in a startup test","Always add the provider artifact (e.g. bcprov-jdk18on) to the runtime module","For native images, verify the provider works with -Dnative tests","Read the ConfigurationException's cause, not just its message"],"tags":["security","configuration","provider-registration","classpath"],"backgroundTag":"security-provider-registration-failed","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"}