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.AmazonClientException: 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..
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()));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With