连接被拒绝:连接

时间:2012-12-10 13:49:35

标签: google-drive-api google-api-java-client

我的目标是每天自动将报告文件从服务器上传到Google云端硬盘。我是Google Drive API计划的新手。当我尝试执行Quickstart中给出的示例程序:在Java中运行驱动器应用程序时,我在输入授权代码后收到以下错误消息。请求帮助您解决此问题。提前谢谢。

  

线程“main”中的异常java.net.ConnectException:Connection   拒绝:连接java.net.PlainSocketImpl.socketConnect(Native   方法)at   java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)at   java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)     在java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)at   java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)at   java.net.Socket.connect(Socket.java:529)at   com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:564)     在sun.net.NetworkClient.doConnect(NetworkClient.java:158)at   sun.net.www.http.HttpClient.openServer(HttpClient.java:395)at   sun.net.www.http.HttpClient.openServer(HttpClient.java:530)at at   sun.net.www.protocol.https.HttpsClient。(HttpsClient.java:272)     在sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:329)     在   sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:172)     在   sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:911)     在   sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:158)     在   sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1014)     在   sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:230)     在   com.google.api.client.http.javanet.NetHttpRequest.execute(NetHttpRequest.java:79)     在   com.google.api.client.http.HttpRequest.execute(HttpRequest.java:895)     在   com.google.api.client.auth.oauth2.TokenRequest.executeUnparsed(TokenRequest.java:299)     在   com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeTokenRequest.execute(GoogleAuthorizationCodeTokenRequest.java:147)     在DriveCommandLine.main(DriveCommandLine.java:43)

2 个答案:

答案 0 :(得分:0)

采用不同的方法,为什么不安装和使用适用于Windows或Mac的Google Drive应用程序?

https://tools.google.com/dlpage/drive?pli=1

它使用OAuth2进行身份验证,并且可以缩小到仅同步某些文件夹。

答案 1 :(得分:0)

这听起来像是基于该错误的防火墙问题。您可以尝试从运行Java脚本的计算机登录到drive.google.com吗?那台机器可以ping www.googleapis.com吗?它有什么互联网限制?