Description
Describe the bug
When attempting to compile a Spring Boot application to a native image using GraalVM, the build fails due to an invalid reflect-config.json
file provided within the apache-client module of the AWS SDK for Java v2. Specifically, the configuration attempts to reference a method org.apache.http.client.config.RequestConfig$Builder.setNormalizeUri()
which does not exist in the version of Apache HTTP Client being used by the SDK.
The problematic reflect-config.json file is located at apache-client/reflect-config.json.
Regression Issue
- Select this option if this issue appears to be a regression.
Expected Behavior
The native image compilation should complete successfully without errors related to the reflect-config.json
provided by the AWS SDK for Java v2. The apache-client module's reflection configuration should accurately reflect the methods available in its dependencies.
Current Behavior
The native compilation fails with the following error output:
[creator] Error: Error parsing reflection configuration in jar:file:/workspace/BOOT-INF/lib/apache-client-2.31.51.jar!/META-INF/native-image/software.amazon.awssdk/apache-client/reflect-config.json:
[creator] Method org.apache.http.client.config.RequestConfig$Builder.setNormalizeUri() not found
[creator] unable to invoke layer creator
[creator] unable to contribute native-image layer
[creator] error running build
[creator] exit status 1
[creator] ERROR: failed to build: exit status 1
This prevents the successful creation of a native executable for applications using the AWS SDK for Java v2 with the Apache HTTP client.
Reproduction Steps
To reproduce this issue, please follow these steps:
- Create a new Spring Boot project.
- Configure the
build.gradle
file as shown below:
plugins {
id 'org.springframework.boot' version '3.4.5'
id 'io.spring.dependency-management' version '1.1.7'
id 'org.graalvm.buildtools.native' version '0.10.6'
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
dependencies {
implementation platform('software.amazon.awssdk:bom:2.31.51')
implementation ('software.amazon.awssdk:dynamodb')
}
- Run the Gradle build command to create a native image:
./gradlew bootBuildImage
- The build will fail with the error messages described in the "Current Behavior" section.
Workaround
A temporary workaround is to exclude the problematic reflect-config.json during the native compilation process by passing the following argument:
--exclude-config apache-client-2.31.51.jar /META-INF/native-image/software.amazon.awssdk/apache-client/reflect-config.json
This allows the native image to be built, but it relies on external configuration and bypasses the provided reflection configuration.
Possible Solution
Update the reflect-config.json
to reflect the current config 😏
Additional Information/Context
./gradlew bootBuildImage
is using Buildpack ID: paketo-buildpacks/java-native-image
AWS Java SDK version used
software.amazon.awssdk:bom:2.31.51
JDK version used
openjdk 24.0.1 2025-04-15 OpenJDK Runtime Environment GraalVM CE 24.0.1+9.1 (build 24.0.1+9-jvmci-b01) OpenJDK 64-Bit Server VM GraalVM CE 24.0.1+9.1 (build 24.0.1+9-jvmci-b01, mixed mode, sharing)
Operating System and version
Mac OS