Dropbox找不到资源trusted-certs.jks

时间:2014-09-27 06:13:45

标签: java ssl dropbox

我试图通常在bukkit插件中使用dropbox java api,但出于某种原因它只是没有工作。以下是dropbox部分的代码:

public DbxClient client;
final String APP_KEY = "<REDACTED>";
final String APP_SECRET = "<REDACTED>";

DbxAppInfo appInfo = new DbxAppInfo(APP_KEY, APP_SECRET);

DbxRequestConfig config = new DbxRequestConfig(
        "JavaTutorial/1.0", Locale.getDefault().toString());
DbxWebAuthNoRedirect webAuth = new DbxWebAuthNoRedirect(config, appInfo);
String authorizeUrl = webAuth.start();

public void geturl(Player p){
    p.sendMessage(authorizeUrl);
}

public void authorize(String code){
    try{
        DbxAuthFinish authFinish = webAuth.finish(code);
        String accessToken = authFinish.accessToken;
        client = new DbxClient(config, accessToken);
    }
    catch(DbxException e){}

}

public void upload(String fullpath){
    try {
        File inputFile = new File(fullpath);
        FileInputStream inputStream = new FileInputStream(inputFile);
        DbxEntry.File uploadedFile = client.uploadFile(fullpath,
                DbxWriteMode.add(), inputFile.length(), inputStream);
        inputStream.close();
    }
    catch(DbxException| IOException e){}

无论如何,geturl工作正常,它返回一个我点击的URL并复制我得到的代码。然后我继续使用该代码作为参数运行授权,我收到此错误:

org.bukkit.event.EventException
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:294) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks]
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks]
    at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:501) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks]
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:483) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks]
    at net.minecraft.server.v1_7_R4.PlayerConnection.chat(PlayerConnection.java:882) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks]
    at net.minecraft.server.v1_7_R4.PlayerConnection.a(PlayerConnection.java:832) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks]
    at net.minecraft.server.v1_7_R4.PacketPlayInChat.a(PacketPlayInChat.java:28) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks]
    at net.minecraft.server.v1_7_R4.PacketPlayInChat.handle(PacketPlayInChat.java:47) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks]
    at net.minecraft.server.v1_7_R4.NetworkManager.a(NetworkManager.java:84) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks]
    at net.minecraft.server.v1_7_R4.NetworkManager.channelRead0(NetworkManager.java:204) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks]
    at net.minecraft.util.io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:98) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks]
    at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks]
    at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks]
    at net.minecraft.util.io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:173) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks]
    at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks]
    at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks]
    at net.minecraft.util.io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:173) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks]
    at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks]
    at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks]
    at net.minecraft.util.io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks]
    at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks]
    at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks]
    at net.minecraft.util.io.netty.handler.timeout.ReadTimeoutHandler.channelRead(ReadTimeoutHandler.java:149) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks]
    at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks]
    at net.minecraft.util.io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks]
    at net.minecraft.util.io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks]
    at net.minecraft.util.io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:100) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks]
    at net.minecraft.util.io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:480) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks]
    at net.minecraft.util.io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:447) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks]
    at net.minecraft.util.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:341) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks]
    at net.minecraft.util.io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks]
    at java.lang.Thread.run(Unknown Source) [?:1.7.0_67]
Caused by: java.lang.AssertionError: Couldn't find resource "trusted-certs.jks"
    at com.dropbox.core.http.SSLConfig.loadKeyStore(SSLConfig.java:312) ~[?:?]
    at com.dropbox.core.http.SSLConfig.createSSLSocketFactory(SSLConfig.java:186) ~[?:?]
    at com.dropbox.core.http.SSLConfig.<clinit>(SSLConfig.java:65) ~[?:?]
    at com.dropbox.core.http.StandardHttpRequestor.prepRequest(StandardHttpRequestor.java:166) ~[?:?]
    at com.dropbox.core.http.StandardHttpRequestor.startPost(StandardHttpRequestor.java:89) ~[?:?]
    at com.dropbox.core.http.StandardHttpRequestor.startPost(StandardHttpRequestor.java:23) ~[?:?]
    at com.dropbox.core.DbxRequestUtil.startPostNoAuth(DbxRequestUtil.java:161) ~[?:?]
    at com.dropbox.core.DbxRequestUtil.doPostNoAuth(DbxRequestUtil.java:271) ~[?:?]
    at com.dropbox.core.DbxWebAuthHelper.finish(DbxWebAuthHelper.java:43) ~[?:?]
    at com.dropbox.core.DbxWebAuthNoRedirect.finish(DbxWebAuthNoRedirect.java:84) ~[?:?]
    at com.czaarek99.antidupe.files.FileExplorer.authorize(FileExplorer.java:197) ~[?:?]
    at com.czaarek99.antidupe.files.FileExplorer.onFileExplore(FileExplorer.java:141) ~[?:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_67]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_67]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_67]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_67]
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:292) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks]
    ... 31 more

很明显,重要的部分是它所引起的地方,我该如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

我在尝试使用webAuth.finish(代码)从Dropbox服务器获取访问代码时遇到了类似的问题。图书馆需要&#34; JKS&#34;在android平台中缺席的密钥库。