从Amazon S3检索数据时遇到错误

时间:2019-01-10 11:37:31

标签: java amazon-web-services amazon-s3

我正在尝试使用AWS访问和AWS密钥从S3存储桶中检索数据。

private final static AmazonS3 s3client = AmazonS3ClientBuilder.standard()
            .withCredentials(new AWSStaticCredentialsProvider(credentials)).withRegion(Regions.US_EAST_1).build();

在pom.xml文件中,我给出了Hadoop-aws和AWS-sdk的版本,如下所示:

    <dependency>
   <groupId>org.apache.httpcomponents</groupId>
   <artifactId>httpclient</artifactId>
   <version>4.5.2</version>
   <scope>runtime</scope>
 </dependency>

 <dependency>
    <groupId>com.amazonaws</groupId>
    <artifactId>aws-java-sdk</artifactId>
    <version>1.11.203</version>
</dependency>

<dependency>
    <groupId>org.apache.hadoop</groupId>
    <artifactId>hadoop-aws</artifactId>
    <version>3.0.0</version>
</dependency>

我得到的错误是:

线程“ main”中的异常java.lang.NoSuchMethodError:com.amazonaws.services.s3.AmazonS3Client。(Lcom / amazonaws / services / s3 / AmazonS3ClientParams;)V     在com.amazonaws.services.s3.AmazonS3Builder $ 1.apply(AmazonS3Builder.java:35)     在com.amazonaws.services.s3.AmazonS3Builder $ 1.apply(AmazonS3Builder.java:32)     在com.amazonaws.services.s3.AmazonS3ClientBuilder.build(AmazonS3ClientBuilder.java:64)     在com.amazonaws.services.s3.AmazonS3ClientBuilder.build(AmazonS3ClientBuilder.java:28)     在com.amazonaws.client.builder.AwsSyncClientBuilder.build(AwsSyncClientBuilder.java:46)

我知道我的AWS-Hadoop和AWS-java-SDK版本不兼容。因此,我尝试尝试并尝试使用一些引用某些网站的版本,但这没有用。

有人可以帮我找出这个吗?

谢谢!

0 个答案:

没有答案