使用Aws sdk从s3下载文件时未找到类异常

时间:2012-11-21 14:27:46

标签: amazon-s3 amazon-web-services classnotfoundexception

I'm using AWS sdk for downloading an object from S3.when i run the program,i keep getting Class not found errors:

java.lang.ClassNotFoundException:org.apache.http.Consts    java.lang.ClassNotFoundException:org.apache.hhtp.params.BasicHttpParams  抛出java.lang.ClassNotFoundException:org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager     我已经在我的应用程序中包含了aws-java-sdk 1.3.26 jar文件和httpcore 4.1以及httpclient 4.2.1 jar,但我仍然收到错误。我已经在我的程序中编写了foll代码,用于从amazon s3下载文件:

AWSCredentials myCredentials = new BasicAWSCredentials(
            credentials);
     AmazonS3Client s3Client = new AmazonS3Client(myCredentials);
     S3Object object = s3Client.getObject(bucket, key);
     InputStream is=object.getObjectContent()

无法解决错误。请帮忙

1 个答案:

答案 0 :(得分:1)

尝试使用httpclient 4.1.1。

4.2+弃用/更改某些功能