Describe the bug
The software.amazon.awssdk:apache5-client module ships broken GraalVM native-image configuration. The SPI service descriptor is correct, but the reflect-config.json (and related metadata) does not register the real provider class.
Introduced with Apache5 HTTP client / making Apache5 the default (2.46.x era). Invalid metadata still present in published jars (e.g. 2.46.17, 2.47.3) and on master before a fix.
Regression Issue
Expected Behavior
META-INF/native-image metadata for apache5-client registers the real SPI implementation class:
software.amazon.awssdk.http.apache5.Apache5SdkHttpService (no-arg constructor)
ServiceLoader.load(SdkHttpService.class) can instantiate that provider in a GraalVM/Mandrel native image
Apache5HttpClient works for normal sync calls in native (when the rest of the app’s native config is sound)
Current Behavior
Invalid metadata in the jar
Under published apache5-client (e.g. 2.47.3):
Path (wrong — copy-pasted from apache-client):
META-INF/native-image/software.amazon.awssdk/apache-client/
reflect-config.json (invalid class name):
{
"name": "import software.amazon.awssdk.http.apache5.ApacheSdkHttpService",
"methods": [{ "name": "<init>", "parameterTypes": [] }]
}
Problems:
- Literal
"import " prefix in the class name
- Wrong simple name:
ApacheSdkHttpService instead of Apache5SdkHttpService
- Real class on disk is
software.amazon.awssdk.http.apache5.Apache5SdkHttpService
proxy-config.json (also broken / obsolete):
[
[
"org.apache.http.conn.HttpClientConnectionManager",
"org.apache.http.pool.ConnPoolControl",
"import software.amazon.awssdk.http.apache5.internal.conn.Wrapped"
],
...
]
- Again uses the
"import " prefix
- Uses HttpClient 4 packages (
org.apache.http.*) while Apache5 uses HC5 (org.apache.hc.client5.*)
- Apache5 wraps connection managers with concrete subclasses, not
Proxy.newProxyInstance; Wrapped is unused in Java code — this file looks like a bad copy from apache-client
Reproduction Steps
Inspect the published jar (no AWS account required)
# any 2.46+ / 2.47.x apache5-client
jar xf ~/.m2/repository/software/amazon/awssdk/apache5-client/2.47.3/apache5-client-2.47.3.jar \
META-INF/native-image META-INF/services
cat META-INF/services/software.amazon.awssdk.http.SdkHttpService
# → software.amazon.awssdk.http.apache5.Apache5SdkHttpService (correct)
cat META-INF/native-image/software.amazon.awssdk/apache-client/reflect-config.json
# → "import software.amazon.awssdk.http.apache5.ApacheSdkHttpService" (incorrect)
Minimal native smoke (SPI + Apache5HttpClient)
import java.util.ServiceLoader;
import software.amazon.awssdk.http.SdkHttpService;
import software.amazon.awssdk.http.apache5.Apache5HttpClient;
import software.amazon.awssdk.http.apache5.Apache5SdkHttpService;
public class Main {
public static void main(String[] args) {
for (SdkHttpService s : ServiceLoader.load(SdkHttpService.class)) {
System.out.println(s.getClass().getName());
}
try (var client = Apache5HttpClient.builder().build()) {
System.out.println(client.clientName());
}
}
}
Compile against apache5-client + its runtime deps, then:
native-image --no-fallback -cp ... -H:Name=smoke Main
./smoke
With broken metadata (stock jar, ServiceLoaderFeature relying on reflect-config / incomplete registration), ServiceLoader instantiation of Apache5SdkHttpService fails in native.
With fixed reflect-config registering the real FQCN, the same program succeeds (verified locally).
Possible Solution
-
Move native-image resources to
META-INF/native-image/software.amazon.awssdk/apache5-client/
-
Fix reflect-config.json to register:
{
"name": "software.amazon.awssdk.http.apache5.Apache5SdkHttpService",
"methods": [{ "name": "<init>", "parameterTypes": [] }]
}
-
Remove or rewrite proxy-config.json (prefer remove: no JDK proxies for Apache5 connection managers).
-
Keep resource-config.json aligned with other HTTP clients.
-
Add regression coverage (e.g. exercise Apache5HttpClient in test/sdk-native-image-test).
Additional Information/Context
No response
AWS Java SDK version used
2.46.17 / 2.47.3 (repro); 2.47.4-SNAPSHOT (local fix verification)
JDK version used
openjdk 25 2025-09-16 LTS OpenJDK Runtime Environment Temurin-25+36 (build 25+36-LTS) OpenJDK 64-Bit Server VM Temurin-25+36 (build 25+36-LTS, mixed mode, sharing)
Operating System and version
MacOS 26
Describe the bug
The
software.amazon.awssdk:apache5-clientmodule ships broken GraalVM native-image configuration. The SPI service descriptor is correct, but thereflect-config.json(and related metadata) does not register the real provider class.Introduced with Apache5 HTTP client / making Apache5 the default (2.46.x era). Invalid metadata still present in published jars (e.g. 2.46.17, 2.47.3) and on
masterbefore a fix.Regression Issue
Expected Behavior
META-INF/native-imagemetadata forapache5-clientregisters the real SPI implementation class:software.amazon.awssdk.http.apache5.Apache5SdkHttpService(no-arg constructor)ServiceLoader.load(SdkHttpService.class)can instantiate that provider in a GraalVM/Mandrel native imageApache5HttpClientworks for normal sync calls in native (when the rest of the app’s native config is sound)Current Behavior
Invalid metadata in the jar
Under published
apache5-client(e.g. 2.47.3):Path (wrong — copy-pasted from apache-client):
reflect-config.json(invalid class name):{ "name": "import software.amazon.awssdk.http.apache5.ApacheSdkHttpService", "methods": [{ "name": "<init>", "parameterTypes": [] }] }Problems:
"import "prefix in the class nameApacheSdkHttpServiceinstead ofApache5SdkHttpServicesoftware.amazon.awssdk.http.apache5.Apache5SdkHttpServiceproxy-config.json(also broken / obsolete):[ [ "org.apache.http.conn.HttpClientConnectionManager", "org.apache.http.pool.ConnPoolControl", "import software.amazon.awssdk.http.apache5.internal.conn.Wrapped" ], ... ]"import "prefixorg.apache.http.*) while Apache5 uses HC5 (org.apache.hc.client5.*)Proxy.newProxyInstance;Wrappedis unused in Java code — this file looks like a bad copy fromapache-clientReproduction Steps
Inspect the published jar (no AWS account required)
Minimal native smoke (SPI + Apache5HttpClient)
Compile against
apache5-client+ its runtime deps, then:With broken metadata (stock jar, ServiceLoaderFeature relying on reflect-config / incomplete registration), ServiceLoader instantiation of
Apache5SdkHttpServicefails in native.With fixed reflect-config registering the real FQCN, the same program succeeds (verified locally).
Possible Solution
Move native-image resources to
META-INF/native-image/software.amazon.awssdk/apache5-client/Fix
reflect-config.jsonto register:{ "name": "software.amazon.awssdk.http.apache5.Apache5SdkHttpService", "methods": [{ "name": "<init>", "parameterTypes": [] }] }Remove or rewrite
proxy-config.json(prefer remove: no JDK proxies for Apache5 connection managers).Keep
resource-config.jsonaligned with other HTTP clients.Add regression coverage (e.g. exercise
Apache5HttpClientintest/sdk-native-image-test).Additional Information/Context
No response
AWS Java SDK version used
2.46.17 / 2.47.3 (repro); 2.47.4-SNAPSHOT (local fix verification)
JDK version used
openjdk 25 2025-09-16 LTS OpenJDK Runtime Environment Temurin-25+36 (build 25+36-LTS) OpenJDK 64-Bit Server VM Temurin-25+36 (build 25+36-LTS, mixed mode, sharing)
Operating System and version
MacOS 26