user3112954
user3112954

Reputation: 155

Unable to calculate MD5 : AWS S3 bucket

I have my application hosted on AWS, Elastic Beanstalk - Tomcat 6. My data files are stored in an S3 bucket. When I am hosting my application on local server on my machine , I am able to read and write data to my S3 bucket (using via SDK), but from the application hosted on Elastic Beanstalk the writing operation is showing an error i.e on Elastic Beanstalk Tomcat. I am getting below error:

com.amazonaws.AmazonClientExceptio­n: Unable to calculate MD5 hash: visitorsinfo.json (No such file or directory)

I do have visitorsinfo.json in my S3 bucket which is successfully accessible from my local server in my machine, but not accessible from Elastic Beanstalk..

Upvotes: 5

Views: 16392

Answers (3)

Siddhartha Moraes
Siddhartha Moraes

Reputation: 184

Man, i have the same problem. But for me, i was forget to set permissions to read files before to send the file. Just this

ActivityCompat.requestPermissions(activity!!, arrayOf(Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE), 300)

Upvotes: -1

Amit Gujarathi
Amit Gujarathi

Reputation: 1100

Instead of passing file object pass the Input Stream to the put object as shown below

InputStream is=file.getInputStream();                                                                           
s3client.putObject(new PutObjectRequest(bucketName, keyName,is,new ObjectMetadata())); 

Upvotes: 7

user3112954
user3112954

Reputation: 155

Got this resolved by creating a new application with configuration 64bit Amazon Linux 2014.03 v1.1.0 running Tomcat 7 Java 6

Upvotes: -1

Related Questions