java.lang.NoSuchFieldError:从AmazonS3下载文件时的ALLOW_FINAL_FIELDS_AS_MUTATORS

时间:2017-10-25 07:42:54

标签: java amazon-s3 download

执行以下代码段时得到了java.lang.NoSuchFieldError:ALLOW_FINAL_FIELDS_AS_MUTATORS。

S3Object object = s3Client.getObject(new GetObjectRequest(bucketName, fileName));

InputStream reader = new BufferedInputStream(object.getObjectContent());
File file = new File(filePathToDownload);      
OutputStream writer = new BufferedOutputStream(new FileOutputStream(file));
int read = -1;
while ( ( read = reader.read() ) != -1 ) {
         writer.write(read);
}

writer.flush();
writer.close();
reader.close(); 

1 个答案:

答案 0 :(得分:0)

最后,我通过在AmazonS3初始化中提供适当的凭据和客户端配置解决了我的错误。谢谢你们的支持。