stevenzwu opened a new issue, #6715:
URL: https://github.com/apache/iceberg/issues/6715

   ### Feature Request / Improvement
   
   
   `WebIdentityTokenFileCredentialsProvider` from 
`DefaultCredentialsProvider`chain  uses DefaultSdkHttpClientBuilder for STS 
client to retrieve IAM credentials for service accounts.
   ```
   public final class DefaultSdkHttpClientBuilder implements 
SdkHttpClient.Builder {
       private static final SdkHttpServiceProvider<SdkHttpService> 
DEFAULT_CHAIN = new CachingSdkHttpServiceProvider<>(
               new SdkHttpServiceProviderChain<>(
                       SystemPropertyHttpServiceProvider.syncProvider(),
                       ClasspathSdkHttpServiceProvider.syncProvider()
     ));
   ```
   
   Right now, `AwsProperties` reference classes from both 
`url-connection-client` and `apache-httpclient`. Hence, we have to include both 
jars as deps to avoid runtime error of .
   ```
         case HTTP_CLIENT_TYPE_URLCONNECTION:
           builder.httpClientBuilder(
               UrlConnectionHttpClient.builder()
                   
.applyMutation(this::configureUrlConnectionHttpClientBuilder));
           break;
         case HTTP_CLIENT_TYPE_APACHE:
           builder.httpClientBuilder(
               
ApacheHttpClient.builder().applyMutation(this::configureApacheHttpClientBuilder));
           break;
   ```
   
   When both jars are included in the runtime classpath, we will see the 
following error from `ClasspathSdkHttpServiceProvider`.
   ```
   "Multiple HTTP implementations were found on the classpath. To avoid 
non-deterministic loading " +
   "implementations, please explicitly provide an HTTP client via the client 
builders, set the %s " +
   "system property with the FQCN of the HTTP service to use as the default, or 
remove all but one " +
   "HTTP implementation from the classpath", implSystemProperty.property()))
   ```
   
   As the error message indicates, we can set the impl class explicitly via -D 
system property. This would work.
   ```
   
-Dsoftware.amazon.awssdk.http.service.impl=software.amazon.awssdk.http.apache.ApacheSdkHttpService
   ```
   
   I like to discuss an alternative solution. We can define an interface to 
configure httpclient and two impl class (url-connection-client and 
apache-httpclient). In `AwsProperties`, it can use reflection to instantiate 
the httpclient configuration impl class. This way, we can avoid runtime deps 
for both jars and the confustion for `ClasspathSdkHttpServiceProvider`.
   
   what do you think? @jackye1995 @danielcweeks 
   
   ### Query engine
   
   None


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to