Unable to verify integrity of data upload. Client calculated content hash (contentMD5: wlkGaKXnoDlHOZDR8aaw5Q== in base 64) didn't match hash (etag: c69e9c108f7f2e117e6101a91628736c in hex) calculated by Amazon S3. You may need to delete the data stored in Amazon S3. (metadata.contentMD5: wlkGaKXnoDlHOZDR8aaw5Q==, md5DigestStream: null, bucketName: zkjr, key: complain\1744704774681MlIsMEMucG5n.png)
网上找了一大圈不是废话都太多了就是没有用,直接说解决方案,在构建AmazonS3 添加一个SignerOverride 配置(重点是这个配置:conf.setSignerOverride(SignerFactory.VERSION_FOUR_UNSIGNED_PAYLOAD_SIGNER);)
AWSCredentials credentials = new BasicAWSCredentials(accessKey, accessValue);
ClientConfiguration conf = new ClientConfiguration();
conf.setSignerOverride(SignerFactory.VERSION_FOUR_UNSIGNED_PAYLOAD_SIGNER);
AmazonS3 amazonS3 = AmazonS3ClientBuilder.standard()
.withCredentials(new AWSStaticCredentialsProvider(credentials))
.withClientConfiguration(conf)
.withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(s3Address,"china"))
.withPathStyleAccessEnabled(true)
.build();
return amazonS3;
如果解决了你的问题,那么请回来点个赞!!!