java.lang.IllegalAccessError:尝试访问方法com.dropbox.core.DbxRequestUtil.addAuthHeader

时间:2016-01-12 20:36:24

标签: java dropbox dropbox-api

我有类Dropbox.java,它包含上传文件功能:

public class Dropbox {
        static final String ACCESS_TOKEN = "<My-Access-Token>";

    DbxRequestConfig config = new DbxRequestConfig("dropbox/java-tutorial", "en_US");
        static final  DbxClientV2 clientV2 = new DbxClientV2(config, ACCESS_TOKEN);

    static public void UploadFile(String path, InputStream in) throws UploadException, DbxException, IOException
    {
        clientV2.files.uploadBuilder(path).run(in);
    }
}

并调用方法如下

InputStream in = getInputStream();
String path="/newFileName.jpg";
Dropbox.CreateFile(path, in);

我为Dropbox添加了这三个罐子: Dropbox的核心-SDK-1.8.2.jar 收存箱核-SDK-2.0-β-4.jar 杰克逊 - 芯 - 2.6.1.jar

我收到此错误:

java.lang.IllegalAccessError: tried to access method com.dropbox.core.DbxRequestUtil.addAuthHeader(Ljava/util/ArrayList;Ljava/lang/String;)Ljava/util/ArrayList; from class com.dropbox.core.v2.DbxRawClientV2
at com.dropbox.core.v2.DbxRawClientV2.uploadStyle(DbxRawClientV2.java:176)
at com.dropbox.core.v2.DbxFiles.upload(DbxFiles.java:8290)
at com.dropbox.core.v2.DbxFiles.access$5900(DbxFiles.java:25)
at com.dropbox.core.v2.DbxFiles$UploadBuilder.start(DbxFiles.java:8338)
at com.dropbox.core.v2.DbxFiles$UploadBuilder.start(DbxFiles.java:8304)
at com.dropbox.core.v2.DbxUploadStyleBuilder.run(DbxUploadStyleBuilder.java:29)
    at classes.Dropbox.CreateFile(Dropbox.java:30)
    at servlets.UploadServlet.doPost(UploadServlet.java:50)

...

1 个答案:

答案 0 :(得分:0)

我刚删除旧罐子: 收存箱核-SDK-1.8.2.jar

并在类

中使用DbxClientV1而不是DbxClient