quarkusio/quarkus · error · RuntimeException
The provided hostname verifier " + verifier + " is not an in
Error message
The provided hostname verifier " + verifier + " is not an instance of HostnameVerifier
What it means
The configured class loaded and was constructed successfully, but the resulting object is not a HostnameVerifier, so the cast to HostnameVerifier threw ClassCastException, wrapped in this RuntimeException. The property is meant to point exclusively at HostnameVerifier implementations.
Source
Thrown at extensions/resteasy-reactive/rest-client/runtime/src/main/java/io/quarkus/rest/client/reactive/runtime/RestClientCDIDelegateBuilder.java:301
oneOf(restClientConfig.verifyHost(), configRoot.verifyHost()).ifPresent(builder::verifyHost);
}
private void registerHostnameVerifier(String verifier, QuarkusRestClientBuilder 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, QuarkusRestClientBuilder builder) {
Optional<String> keyStorePassword = oneOf(restClientConfig.keyStorePassword(), configRoot.keyStorePassword());
Optional<String> keyStoreType = oneOf(restClientConfig.keyStoreType(), configRoot.keyStoreType());
try {
KeyStore keyStore = KeyStore.getInstance(keyStoreType.orElse("JKS"));
if (keyStorePassword.isEmpty()) {
throw new IllegalArgumentException("No password provided for keystore");
}
String password = keyStorePassword.get();
try (InputStream input = locateStream(keyStorePath)) {
keyStore.load(input, password.toCharArray());
} catch (IOException | CertificateException | NoSuchAlgorithmException e) {View on GitHub (pinned to e1c734241f)
Solutions
- Implement jakarta.net.ssl.HostnameVerifier (javax.net.ssl.HostnameVerifier on older stacks) in the configured class.
- Verify the property value references the intended verifier class, not another SSL type.
- If wrapping a third-party verifier, create a small adapter class implementing HostnameVerifier.
Example fix
// before
public class MyChecker { public boolean check(String h, SSLSession s) {...} } // not a HostnameVerifier
// after
public class MyChecker implements HostnameVerifier {
public boolean verify(String hostname, SSLSession session) { ... }
} Defensive patterns
Strategy: type-guard
Validate before calling
Object v = Class.forName("com.example.MyVerifier").getDeclaredConstructor().newInstance();
if (!(v instanceof javax.net.ssl.HostnameVerifier)) {
throw new IllegalStateException("Configured class is not a HostnameVerifier");
} Type guard
boolean isHostnameVerifier(String className) {
try {
Object o = Thread.currentThread().getContextClassLoader().loadClass(className).getDeclaredConstructor().newInstance();
return o instanceof javax.net.ssl.HostnameVerifier;
} catch (Exception e) { return false; }
} Try / catch
try {
// build client with configured verifier
} catch (RuntimeException e) {
if (e.getMessage() != null && e.getMessage().contains("is not an instance of HostnameVerifier")) {
builder.hostnameVerifier(new DefaultVerifier());
} else throw e;
} Prevention
- Confirm the configured class implements javax.net.ssl.HostnameVerifier (or the jakarta equivalent used by your Quarkus version).
- Do not point the property at trust managers or other SSL utilities.
- Write an adapter class when wrapping third-party verifiers.
When it happens
Trigger: Setting the hostname-verifier property to a class that implements a similar interface (e.g. a custom checker) but not jakarta/javax.net.ssl.HostnameVerifier.
Common situations: Pointing the property at an X509TrustManager, a Spring-style HostnameVerifier, or a similarly-named class from another library; mixing javax/jakarta or different SSL utility types; copy-paste errors in configuration.
Related errors
- Could not find a public, no-argument constructor for the hos
- Could not find hostname verifier class " + verifier
- Failed to instantiate hostname verifier class " + verifier +
- No password provided for keystore
- Failed to initialize trust store from classpath resource " +
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/e5900ee0d9b473a1.
Report an issue: GitHub.