public class ImgeUtil {
public static String uploadimga( File file, String bucketName, String folder){
try {
OSSClient client = new OSSClient(OSSClientConstants.ENDPOINT,OSSClientConstants.ACCESS_KEY_ID, OSSClientConstants.ACCESS_KEY_SECRET);
PutObjectResult objectResult =client.putObject(bucketName, folder, file);
System.out.println(objectResult);
} catch (FileNotFoundException e) {
System.out.println("出错了");
e.printStackTrace();
}
return "";
}
public static void main(String[] args) {
String files="D:\\Fiddleheads_ZH-CN14463697077_1920x1080.jpg";
File fi= new File(files);
ImgeUtil.uploadimga(fi, OSSClientConstants.BACKET_NAME, OSSClientConstants.FOLDER);
}
}
运行就报错,大神能给我看下吗?
一下报错信息
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/ssl/TrustStrategy
at com.aliyun.oss.OSSClient.<init>(OSSClient.java:208)
at com.aliyun.oss.OSSClient.<init>(OSSClient.java:129)
at com.jwsz.util.ImgeUtil.uploadimga(ImgeUtil.java:14)
at com.jwsz.util.ImgeUtil.main(ImgeUtil.java:27)
Caused by: java.lang.ClassNotFoundException: org.apache.http.ssl.TrustStrategy
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 4 more
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。