quarkusio/quarkus · error · RuntimeException
Could not find hostname verifier class ${verifier}
Error message
Could not find hostname verifier class ${verifier} What it means
The hostname verifier class name configured for a REST client could not be loaded through the thread context class loader (ClassNotFoundException). The value must be a fully qualified class name visible to the application at runtime. This typically means the class name is wrong or the class is not on the classpath/native image.
Source
Thrown at extensions/resteasy-classic/resteasy-client/runtime/src/main/java/io/quarkus/restclient/runtime/RestClientBase.java:159
registerHostnameVerifier(hostnameVerifier.get(), builder);
} else {
// If `verify-host` is disabled, we configure the client using the `NoopHostnameVerifier` verifier.
Optional<Boolean> verifyHost = oneOf(restClientConfig.verifyHost(), configRoot.verifyHost());
if (verifyHost.isPresent() && !verifyHost.get()) {
registerHostnameVerifier(NoopHostnameVerifier.class.getName(), builder);
}
}
}
private void registerHostnameVerifier(String verifier, RestClientBuilder builder) {
try {
Class<?> verifierClass = Thread.currentThread().getContextClassLoader().loadClass(verifier);
builder.hostnameVerifier((HostnameVerifier) verifierClass.getDeclaredConstructor().newInstance());
} catch (NoSuchMethodException e) {
throw new RuntimeException(
"Could not find a public, no-argument constructor for the hostname verifier class " + verifier, e);
} catch (ClassNotFoundException e) {
throw new RuntimeException("Could not find hostname verifier class " + verifier, e);
} catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
throw new RuntimeException(
"Failed to instantiate hostname verifier class " + verifier
+ ". Make sure it has a public, no-argument constructor",
e);
} catch (ClassCastException e) {
throw new RuntimeException("The provided hostname verifier " + verifier + " is not an instance of HostnameVerifier",
e);
}
}
private void registerKeyStore(String keyStorePath, RestClientBuilder builder) {
try {
Optional<String> keyStoreType = oneOf(restClientConfig.keyStoreType(), configRoot.keyStoreType());
KeyStore keyStore = KeyStore.getInstance(keyStoreType.orElse("JKS"));
Optional<String> keyStorePassword = oneOf(restClientConfig.keyStorePassword(), configRoot.keyStorePassword());
if (keyStorePassword.isEmpty()) {View on GitHub (pinned to e1c734241f)
Solutions
- Verify the configured value is the exact fully-qualified class name (package included, correct case)
- Add the module/jar containing the class to the application dependencies
- Check that the class wasn't renamed or moved; update the config accordingly
Example fix
# before quarkus.rest-client.my-client.hostname-verifier=com.acme.MyHostVerifier # after quarkus.rest-client.my-client.hostname-verifier=com.acme.security.MyHostnameVerifier
Defensive patterns
Strategy: validation
Validate before calling
try {
Class.forName(verifierName, false, Thread.currentThread().getContextClassLoader());
} catch (ClassNotFoundException e) {
throw new IllegalStateException("Hostname verifier class not on classpath: " + verifierName);
} Try / catch
try {
// build the rest client / start the app
} catch (RuntimeException e) {
if (e.getCause() instanceof ClassNotFoundException) {
log.error("Check hostname-verifier config value and app dependencies");
}
} Prevention
- Always use fully-qualified class names in hostname-verifier config
- Add the artifact containing the verifier as an application dependency
- Update config when refactoring class names/packages
- Verify class visibility under Quarkus' split classloading
When it happens
Trigger: Setting quarkus.rest-client.<name>.hostname-verifier (or matching MicroProfile config) to a misspelled or non-existent fully-qualified class name, or a class in a module/jar not included in the application.
Common situations: Typos or wrong package in the configured class name; class lives in a library not declared as a dependency; native-image build excluded the class (no reflection/registration needed for load, but the class itself must be reachable); renaming/refactoring the class without updating config.
Related errors
- Could not find a public, no-argument constructor for the hos
- Failed to instantiate hostname verifier class ${verifier}. M
- The provided hostname verifier ${verifier} is not an instanc
- No password provided for keystore
- Failed to initialize trust store from classpath resource ${k
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/82a3c8edd5caa706.
Report an issue: GitHub.