You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用AmazonS3客户端调用listBuckets时遭遇Unable to execute HTTP request错误的求助

AmazonS3客户端调用listBuckets时遭遇Unable to execute HTTP request错误的求助

我有一个Java 17应用,现在想连接NetApp站点上托管的S3存储容器,目前只是想先验证连接是否正常,执行一个简单的listBuckets调用,但一直没搞明白问题出在哪,也不知道该怎么往下推进。

我已经完成了这些准备工作:

  • 在NetApp站点上创建了对应的存储桶
  • 生成了访问密钥(包含Access Key和Secret Key)

下面是我目前的代码(其实这已经是我查资料、问AI后尝试的方案之一了):

// Set up your AWS credentials  
String accessKey = "The Access Key I created in NetApp";
String secretKey = "The Secret Key I created in NetApp";

// Set up your S3 endpoint configuration
String endpoint = "https://cee-sgaadm.bhinc.gov";  //This is the base url of the NetApp interface
String region = "us-east-1";

// Create an AWS credentials provider
BasicAWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey);
AWSStaticCredentialsProvider credentialsProvider = new AWSStaticCredentialsProvider(credentials);

// Create an endpoint configuration for the S3-compatible storage service
AwsClientBuilder.EndpointConfiguration endpointConfiguration = new AwsClientBuilder.EndpointConfiguration(endpoint, region);


// Create an Amazon S3 client with the specified endpoint configuration
AmazonS3 s3Client = AmazonS3ClientBuilder.standard()
            .withEndpointConfiguration(endpointConfiguration)
            .withCredentials(credentialsProvider)
            .build();

// You can now use your S3 client to perform operations
System.out.println("S3 client setup successfully.");


// Here's where it dies with a Unable to execute HTTP request: Connection reset error
s3Client.listBuckets();

现在的问题是,代码执行到listBuckets()调用时就失败了,报错信息是“Unable to execute HTTP request: Connection reset”。我现在有点摸不着头脑,不知道到底是哪里出了问题,有没有大佬能给点建议?

非常感谢!

备注:内容来源于stack exchange,提问作者Tim

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.14 09:14:34