Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/client/CredentialsProvider
at com.aliyun.oss.OSSClient.<init>(OSSClient.java:208)
at com.aliyun.oss.OSSClient.<init>(OSSClient.java:129)
at 学生端.PutRespondent.connectOSS(PutRespondent.java:22)
at 学生端.PutRespondent.main(PutRespondent.java:29)
Caused by: java.lang.ClassNotFoundException: org.apache.http.client.CredentialsProvider
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 4 more
package 学生端;
import com.aliyun.oss.OSSClient;
import com.aliyun.openservices.oss.OSSClient;
public class PutRespondent {
private String endpoint="http://oss-cn-shenzhen.aliyuncs.com";
private String accessKeyId="我的accessKeyId";//密钥是正确的
private String accessKeySecret="我的accessKeySecret";
private String bucketName="testrespondent";
private String Key=null;
public PutRespondent()
{
}
public PutRespondent(String key)
{
this.Key=key;
}
public void connectOSS()
{
try{
OSSClient os=new OSSClient(endpoint,accessKeyId,accessKeySecret);
}catch(Exception e) {}
System.out.println("OSS连接成功!");
}
public static void main(String []args)
{
new PutRespondent().connectOSS();
}
}
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。