This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git


The following commit(s) were added to refs/heads/main by this push:
     new ef3d7b72a9 Fix AWS native build NoClassDefFoundError for S3 CRT 
ResumeToken
ef3d7b72a9 is described below

commit ef3d7b72a980935e5de9a40e15e4333aac0f1fe5
Author: JinyuChen97 <[email protected]>
AuthorDate: Tue Sep 8 07:06:51 2026 +0100

    Fix AWS native build NoClassDefFoundError for S3 CRT ResumeToken
    
    Remove compile-scope S3 SDK dependency from the shared AWS test support 
module to prevent S3InternalSdkHttpExecutionAttribute from appearing on the 
native image classpath of non-S3 AWS extensions. Replace the instanceof 
S3ClientBuilder check in Aws2TestEnvContext with a service-based check and 
reflection to avoid the compile-time import.
---
 integration-tests-support/aws2/pom.xml                       |  4 ----
 .../camel/quarkus/test/support/aws2/Aws2TestEnvContext.java  | 12 +++++++++---
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/integration-tests-support/aws2/pom.xml 
b/integration-tests-support/aws2/pom.xml
index 00bd9abaf0..f015d4a31c 100644
--- a/integration-tests-support/aws2/pom.xml
+++ b/integration-tests-support/aws2/pom.xml
@@ -62,10 +62,6 @@
             <groupId>software.amazon.awssdk</groupId>
             <artifactId>auth</artifactId>
         </dependency>
-        <dependency>
-            <groupId>software.amazon.awssdk</groupId>
-            <artifactId>s3</artifactId>
-        </dependency>
         <dependency>
             <groupId>org.apache.camel.quarkus</groupId>
             <artifactId>camel-quarkus-integration-test-support</artifactId>
diff --git 
a/integration-tests-support/aws2/src/test/java/org/apache/camel/quarkus/test/support/aws2/Aws2TestEnvContext.java
 
b/integration-tests-support/aws2/src/test/java/org/apache/camel/quarkus/test/support/aws2/Aws2TestEnvContext.java
index ea96bbe7c8..6f792b2133 100644
--- 
a/integration-tests-support/aws2/src/test/java/org/apache/camel/quarkus/test/support/aws2/Aws2TestEnvContext.java
+++ 
b/integration-tests-support/aws2/src/test/java/org/apache/camel/quarkus/test/support/aws2/Aws2TestEnvContext.java
@@ -17,6 +17,7 @@
 package org.apache.camel.quarkus.test.support.aws2;
 
 import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
 import java.net.URI;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -37,7 +38,6 @@ import 
software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
 import software.amazon.awssdk.awscore.client.builder.AwsClientBuilder;
 import software.amazon.awssdk.core.SdkClient;
 import software.amazon.awssdk.regions.Region;
-import software.amazon.awssdk.services.s3.S3ClientBuilder;
 
 /**
  * A context passed to {@link 
Aws2TestEnvCustomizer#customize(Aws2TestEnvContext)}.
@@ -196,8 +196,14 @@ public class Aws2TestEnvContext {
                     .region(Region.of(region));
 
             // S3 requires path-style access with Floci to avoid virtual-host 
DNS issues
-            if (builder instanceof S3ClientBuilder s3Builder) {
-                s3Builder.forcePathStyle(true);
+            if (service == Service.S3) {
+                try {
+                    Method m = builder.getClass().getMethod("forcePathStyle", 
Boolean.class);
+                    m.setAccessible(true);
+                    m.invoke(builder, Boolean.TRUE);
+                } catch (ReflectiveOperationException e) {
+                    throw new RuntimeException("Could not set forcePathStyle 
on S3 client builder", e);
+                }
             }
         } else if (service == Service.IAM) {
             /* Avoid UnknownHostException: iam.eu-central-1.amazonaws.com */

Reply via email to