Skip to content

Invalid reflect-config.json for apache-client module causing native compilation failure #6143

Open
@jpete

Description

@jpete

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:

  1. Create a new Spring Boot project.
  2. 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')
}
  1. Run the Gradle build command to create a native image: ./gradlew bootBuildImage
  2. 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

Activity

added
bugThis issue is a bug.
needs-triageThis issue or PR still needs to be triaged.
on May 29, 2025
self-assigned this
on May 30, 2025
debora-ito

debora-ito commented on Jun 2, 2025

@debora-ito
Member

@jpete which version of org.apache.httpcomponents:httpclient are you using? Is it 5.x?

Java SDK v2 has a dependency on 4.5.13 and setNormalizeUri() is present in this version.

I'm working in a local repro case in the meantime.

added
investigatingThis issue is being investigated and/or work is in progress to resolve the issue.
and removed
needs-triageThis issue or PR still needs to be triaged.
on Jun 2, 2025
jpete

jpete commented on Jun 5, 2025

@jpete
Author

env $(cat .env | xargs) ./gradlew dependencies --configuration runtimeClasspath | grep -B 5 -A 5 httpclient
| +--- software.amazon.awssdk:apache-client:2.31.51
| | +--- software.amazon.awssdk:http-client-spi:2.31.51 ()
| | +--- software.amazon.awssdk:metrics-spi:2.31.51 (
)
| | +--- software.amazon.awssdk:utils:2.31.51 (*)
| | +--- software.amazon.awssdk:annotations:2.31.51
| | +--- org.apache.httpcomponents:httpclient:4.5.13
| | | +--- org.apache.httpcomponents:httpcore:4.4.13 -> 4.4.16
| | | +--- commons-logging:commons-logging:1.2
| | | --- commons-codec:commons-codec:1.11 -> 1.17.2
| | +--- org.apache.httpcomponents:httpcore:4.4.16
| | --- commons-codec:commons-codec:1.17.1 -> 1.17.2

removed
investigatingThis issue is being investigated and/or work is in progress to resolve the issue.
on Jun 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @debora-ito@jpete

      Issue actions

        Invalid reflect-config.json for apache-client module causing native compilation failure · Issue #6143 · aws/aws-sdk-java-v2