[BugFix] Fix iceberg aws "Multiple HTTP implementations were found on the classpath" exception (#29824)

Signed-off-by: Smith Cruise <chendingchao1@126.com>
This commit is contained in:
Smith Cruise 2023-08-24 12:37:35 +08:00 committed by GitHub
parent 691380242d
commit ac413123f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 5 deletions

View File

@ -180,6 +180,17 @@ public class StarRocksFE {
addShutdownHook();
// To resolve: "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 software.amazon.awssdk.http.service.impl system property with the FQCN of the HTTP service to
// use as the default, or remove all but one HTTP implementation from the classpath"
// Currently, there are 2 implements of HTTP client: ApacheHttpClient and UrlConnectionHttpClient
// The UrlConnectionHttpClient is introduced by #16602, and it causes the exception.
// So we set the default HTTP client to UrlConnectionHttpClient.
// TODO: remove this after we remove ApacheHttpClient
System.setProperty("software.amazon.awssdk.http.service.impl",
"software.amazon.awssdk.http.urlconnection.UrlConnectionSdkHttpService");
LOG.info("FE started successfully");
while (!stopped) {

View File

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package com.starrocks.connector.iceberg.glue;
package com.starrocks.connector.iceberg;
import com.google.common.base.Preconditions;
import org.apache.iceberg.aws.AwsClientFactory;
@ -116,7 +116,6 @@ public class IcebergAwsClientFactory implements AwsClientFactory {
String region) {
// Build sts client
StsClientBuilder stsClientBuilder = StsClient.builder().credentialsProvider(baseCredentials);
stsClientBuilder.applyMutation(awsProperties::applyHttpClientConfigurations);
if (!region.isEmpty()) {
stsClientBuilder.region(Region.of(region));
}
@ -159,8 +158,6 @@ public class IcebergAwsClientFactory implements AwsClientFactory {
s3ClientBuilder.endpointOverride(URI.create(s3Endpoint));
}
s3ClientBuilder.applyMutation(awsProperties::applyHttpClientConfigurations);
return s3ClientBuilder.build();
}
@ -185,7 +182,6 @@ public class IcebergAwsClientFactory implements AwsClientFactory {
glueClientBuilder.endpointOverride(URI.create(glueEndpoint));
}
glueClientBuilder.applyMutation(awsProperties::applyHttpClientConfigurations);
return glueClientBuilder.build();
}

View File

@ -20,6 +20,7 @@ import com.google.common.collect.Maps;
import com.starrocks.catalog.Database;
import com.starrocks.common.MetaNotFoundException;
import com.starrocks.connector.exception.StarRocksConnectorException;
import com.starrocks.connector.iceberg.IcebergAwsClientFactory;
import com.starrocks.connector.iceberg.IcebergCatalog;
import com.starrocks.connector.iceberg.IcebergCatalogType;
import com.starrocks.connector.iceberg.cost.IcebergMetricsReporter;