-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Description
I'm trying to store the image to S3 bucket using latest aws-sdk-java using maven but getting this error I'm not sure, I'm doing anything wrong here.
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-bom</artifactId>
<version>1.11.280</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-s3</artifactId>
</dependency>
</dependencies>
public void SaveBinaryObject(String keyName, BinaryContent binaryContent) throws Exception
{
try {
LOG.info("SaveBinaryObject: Start...");
InputStream inputBinaryStream = new ByteArrayInputStream(binaryContent.getContent());
ObjectMetadata objMeta = new ObjectMetadata();
objMeta.setContentEncoding("UTF-8");
objMeta.setContentLength(binaryContent.getContent().length);
objMeta.setContentType("image/jpg");
BasicAWSCredentials awsCreds = new BasicAWSCredentials(accessKeyId, secretAccessKey);
AmazonS3 amazonS3 = new AmazonS3Client(awsCreds);
if (amazonS3 != null) {
amazonS3.putObject(new PutObjectRequest(
bucketName, keyName, inputBinaryStream, objMeta)
.withCannedAcl(CannedAccessControlList.PublicRead));
LOG.info("SaveBinaryObject: Upload complete");
} else {
LOG.info("SaveBinaryObject: Upload can't be done amazonS3 null");
}
}
//catch (AmazonClientException amazonClientException) {
catch (Exception e)
{
LOG.error(e.getLocalizedMessage(),e);
//LOG.error("Unable to upload file, upload was aborted.",amazonClientException);
}
}
Caused by: java.lang.NoSuchMethodError: com.amazonaws.SDKGlobalConfiguration.isInRegionOptimizedModeEnabled()Z
at com.amazonaws.ClientConfigurationFactory.getConfig(ClientConfigurationFactory.java:35)
at com.amazonaws.services.s3.AmazonS3Client.(AmazonS3Client.java:478)
at com.tridion.storage.aws.AwsClientRequest.(AwsClientRequest.java:33)
at com.tridion.storage.aws.dao.FSAWSBinaryContentDAO.(FSAWSBinaryContentDAO.java:39)
... 57 common frames omitted
Metadata
Metadata
Assignees
Labels
No labels