quarkusio/quarkus · critical · RuntimeException
Could not find ${BUILDER_BASE_CLASS_NAME}#withJson(...); doe
Error message
Could not find ${BUILDER_BASE_CLASS_NAME}#withJson(...); does the version of Elasticsearch Java Client match the version specified in the Quarkus BOM? What it means
ElasticsearchJavaClientFeature is a native-image feature that looks up the Elasticsearch Java client's base builder class and its withJson(JsonParser, JsonpMapper) method during native analysis. If the method cannot be found, the installed client version does not match what the Quarkus BOM expects, and it throws a RuntimeException telling you to check version alignment.
Source
Thrown at extensions/elasticsearch-java-client/runtime/src/main/java/io/quarkus/elasticsearch/javaclient/runtime/graalvm/ElasticsearchJavaClientFeature.java:43
public final class ElasticsearchJavaClientFeature implements Feature {
private static final String BUILDER_BASE_CLASS_NAME = "co.elastic.clients.util.WithJsonObjectBuilderBase";
/**
* To set this, add `-J-Dio.quarkus.elasticsearch.javaclient.graalvm.diagnostics=true` to the native-image parameters,
* e.g. pass this to Maven:
* -Dquarkus.native.additional-build-args=-J-Dio.quarkus.elasticsearch.javaclient.graalvm.diagnostics=true
*/
private static final boolean log = Boolean.getBoolean("io.quarkus.elasticsearch.javaclient.graalvm.diagnostics");
@Override
public void beforeAnalysis(BeforeAnalysisAccess access) {
Class<?> builderClass = access.findClassByName(BUILDER_BASE_CLASS_NAME);
Executable withJsonMethod;
try {
withJsonMethod = builderClass.getMethod("withJson", JsonParser.class, JsonpMapper.class);
} catch (NoSuchMethodException e) {
throw new RuntimeException("Could not find " + BUILDER_BASE_CLASS_NAME + "#withJson(...);"
+ " does the version of Elasticsearch Java Client match the version specified in the Quarkus BOM?");
}
access.registerReachabilityHandler(this::onWithJsonReachable, withJsonMethod);
}
private void onWithJsonReachable(DuringAnalysisAccess access) {
// The builder base class' withJson(...) method is reachable.
logf("%s#withJson(...) is reachable", BUILDER_BASE_CLASS_NAME);
// We don't know on which builder subclass the withJson(...) method is called,
// so to be safe we consider every reachable builder subclass.
for (Class<?> builderSubClass : access.reachableSubtypes(WithJsonObjectBuilderBase.class)) {
enableBuilderWithJson(builderSubClass, access);
}
}
private void enableBuilderWithJson(Class<?> builderSubClass, DuringAnalysisAccess access) {
// We don't care about abstract builder classesView on GitHub (pinned to e1c734241f)
Solutions
- Remove explicit elasticsearch-java version overrides and let the Quarkus BOM manage it
- Run mvn dependency:tree and align co.elastic.clients:elasticsearch-java with the Quarkus BOM version
- If a newer client is required, upgrade Quarkus to a version whose BOM includes it
Example fix
// before (pom.xml) <dependency><groupId>co.elastic.clients</groupId><artifactId>elasticsearch-java</artifactId><version>9.0.0</version></dependency> // after <dependency><groupId>co.elastic.clients</groupId><artifactId>elasticsearch-java</artifactId></dependency> <!-- version from Quarkus BOM -->
Defensive patterns
Strategy: fallback
Validate before calling
// before native build mvn dependency:tree -Dincludes=co.elastic.clients:elasticsearch-java // confirm the version matches the Quarkus BOM
Prevention
- Let the Quarkus BOM manage elasticsearch-java versions
- Check dependency:tree after any BOM/pin changes
- Run a native build in CI to catch version drift early
When it happens
Trigger: Building a native image while the application overrides the Elasticsearch Java client version with one whose ObjectBuilderBase lacks withJson(JsonParser, JsonpMapper), or the class name BUILDER_BASE_CLASS_NAME moved between major client versions.
Common situations: Dependency-management conflicts pulling a newer/older co.elastic.clients:elasticsearch-java; explicit version pinning in the app pom; Spring-style BOM imports overriding Quarkus BOM versions.
Related errors
- Cannot parse version from output: ${stringOutput}
- Not Implemented in native mode
- Unable to create new instance for ${clazz}
- .pfa font files are not supported. Use TrueType fonts, i.e.
- .pfb font files are not supported. Use TrueType fonts, i.e.
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/eab606a1821969a6.
Report an issue: GitHub.