java上传图片到七牛云报错?
java上传图片到七牛云报错
java.lang.IllegalAccessError: class com.qiniu.http.Client$1 cannot access its superclass okhttp3.EventListener
代码:
@Test public void upload() throws FileNotFoundException{
String accessKey = "***5obdCiTy5qEz_7xl_i6J6YNc3***";
String secretKey = "***DOfbX8SqbYjPkDQEvcpHzzs6p***";
String bucket = "***xxxxx***";
Auth auth = Auth.create(accessKey, secretKey);
String upToken = auth.uploadToken(bucket);
String localFilePath="/E:/zip/beilin.jpg";
String key = null;
Configuration cfg = new Configuration();
cfg.resumableUploadAPIVersion = Configuration.ResumableUploadAPIVersion.V2;
UploadManager uploadManager = new UploadManager(cfg);
Response put = null;
try {
put = uploadManager.put(localFilePath, key, upToken);
DefaultPutRet putRet = new Gson().fromJson(put.bodyString(), DefaultPutRet.class);
System.out.println(putRet.key);
System.out.println(putRet.hash);
} catch (QiniuException e) {
Response r = e.response;
System.err.println(r.toString());
try {
System.err.println(r.bodyString());
} catch (QiniuException ex) {
}
}
以上是 java上传图片到七牛云报错? 的全部内容, 来源链接: utcz.com/p/944843.html