Error while writing file to Amazon S3 bucket NoSuchFieldERROR INSTANCE

22 Views Asked by At
AmazonS3 s3Client = new AmazonS3Client();
                try {
                    ByteArrayInputStream dataStream = new ByteArrayInputStream(barry);
                    ObjectMetadata obkmeta = new ObjectMetadata();
                    obkmeta.setContentType("image/jpg");
                    obkmeta.setContentLength(barry.length);
                    //s3Client.putObject(SAAStoken, fileStoreFolderURL+ filename, dataStream, obkmeta);
                    s3Client.putObject(SAAStoken, "mediarepo/SessionFile/"+ filename+".jpg", dataStream, obkmeta);
                } catch (AmazonServiceException e) {
                    System.err.println(e.getErrorMessage());
                }

enter image description here

<dependency>
    <groupId>org.apache.httpcomponents</groupId>
    <artifactId>httpcore</artifactId>
    <version>4.4.7</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
<dependency>
    <groupId>org.apache.httpcomponents</groupId>
    <artifactId>httpclient</artifactId>
    <version>4.4</version>
</dependency>

**I have tried upgrading versions. Please help

  1. Upgraded httpclient version
  2. Same piece of code working in another project

**

0

There are 0 best solutions below