Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why I get error ClassNotFoundException: com.amazonaws.auth.AWSCredentialsProvider?

Tags:

java

amazon-s3

I installed the AWS toolkit for java and connected it to my project in buildpath, I tried to upload file to S3.

File fileOfImages = new File("/sdcard/Save Image Tutorial");
AmazonS3 s3client = new AmazonS3Client(new ProfileCredentialsProvider());        
s3client.putObject(new PutObjectRequest("rosh-haayin-images", "images",fileOfImages)); 

but I get following error :

ClassNotFoundException: com.amazonaws.auth.AWSCredentialsProvider

Could someone explain why this exception occurs?

like image 971
Toda Avatar asked Feb 15 '16 11:02

Toda


1 Answers

It means you are missing aws-java-sdk-1.10.X.jar in your project build path.

$ jar tvf /home/xxx/aws-java-sdk/1.10.52/lib/aws-java-sdk-1.10.52.jar |grep AWSCredentialsProvider
  3485 Thu Feb 11 22:22:34 IST 2016 com/amazonaws/auth/AWSCredentialsProviderChain.class
   233 Thu Feb 11 22:22:34 IST 2016 com/amazonaws/auth/AWSCredentialsProvider.class
   806 Thu Feb 11 22:22:34 IST 2016 com/amazonaws/auth/DefaultAWSCredentialsProviderChain.class

verify that your project refers(Java Build Path) to the jar.

like image 198
Yair Harel Avatar answered Oct 20 '22 13:10

Yair Harel