我想从桌面Java应用程序上传和下载文件到任何云。我在网上搜索并发现了Temboo。我尝试使用它并编写一些代码来在我的DropBox帐户中创建一个示例文件夹。
我在DropBox中创建了一个App,并获得了App Key和App Secret。然后我使用https://live.temboo.com/library/Library/Dropbox/FileOperations/CreateFolder/ OAUTH向导并获得了我的访问令牌和访问令牌秘密。现在,我尝试在代码下面运行以创建名为“Test”的文件夹
CreateFolder createFolder = new com.temboo.Library.Dropbox.FileOperations.CreateFolder(session);
CreateFolder.CreateFolderInputSet createFolderInput = createFolder.newInputSet();
createFolderInput.set_NewFolderName(DROPBOX_BACKUP_FOLDERNAME);
createFolderInput.set_AppKey(DROPBOX_APP_KEY);
createFolderInput.set_AppSecret(DROPBOX_APP_SECRET);
createFolderInput.set_AccessToken(DROPBOX_ACCESS_TOKEN);
createFolderInput.set_AccessTokenSecret(DROPBOX_ACCESS_TOKEN_SECRET);
createFolder.execute(createFolderInput);
当我运行上面的代码时,它会抛出异常:
createFolder.execute(createFolderInput);
请查看例外情况:
com.temboo.core.TembooException: peer not authenticated
at com.temboo.core.TembooSession.postContent(TembooSession.java:168)
at com.temboo.core.Choreography.executeWithResults(Choreography.java:88)
at com.temboo.Library.Dropbox.FileOperations.CreateFolder.execute(CreateFolder.java:50)
at TestPackage.DropBoxCloudServer.createFolder(DropBoxCloudServer.java:55)
at TestPackage.DropBoxCloudServer.main(DropBoxCloudServer.java:20)
Caused by: javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated
at com.sun.net.ssl.internal.ssl.SSLSessionImpl.getPeerCertificates(SSLSessionImpl.java:352)
at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:128)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:339)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:123)
at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:147)
at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:108)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:415)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:641)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:576)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:554)
at com.temboo.core.TembooSession.postContent(TembooSession.java:151)
... 4 more
答案 0 :(得分:0)
我在Temboo工作。
您的本地开发环境中似乎遇到了SSL证书问题。在这个相关的问题上有一些很好的建议:
SSLPeerUnverifiedException: peer not authenticated
希望能让你在Dropbox + Temboo中运行起来。如果没有,请不要犹豫,让我知道,我们会继续调查。
答案 1 :(得分:0)
您好我自己刚刚找到解决方案..我刚刚将我的Java更新为最新的JDK版本,它正在运行f9 .. appart,我需要添加
createFolderInput.set_Root("sandbox");
到我的代码..现在工作正常..