【问题标题】:Error while using PicasawebService with GAE将 PicasawebService 与 GAE 一起使用时出错
【发布时间】:2013-10-11 14:32:37
【问题描述】:

我正在尝试从我的 GAE 应用程序连接到 picassa 网络相册。但我无法进行身份验证。

PicasawebService myService = new PicasawebService("myclub");
myService.setUserCredentials("username@gmail.com", "my_password");

我得到的错误是

com.google.gdata.util.AuthenticationException: Error connecting with login URI
    at com.google.gdata.client.GoogleAuthTokenFactory.getAuthToken(GoogleAuthTokenFactory.java:549)
    at com.google.gdata.client.GoogleAuthTokenFactory.setUserCredentials(GoogleAuthTokenFactory.java:397)
    at com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:364)
    at com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:319)
    at com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:303)


Caused by: java.net.SocketTimeoutException: Timeout while fetching: https://www.google.com/accounts/ClientLogin
    at com.google.appengine.api.urlfetch.URLFetchServiceImpl.fetch(URLFetchServiceImpl.java:52)
    at com.google.apphosting.utils.security.urlfetch.URLFetchServiceStreamHandler$Connection.fetchResponse(URLFetchServiceStreamHandler.java:417)
    at com.google.apphosting.utils.security.urlfetch.URLFetchServiceStreamHandler$Connection.getInputStream(URLFetchServiceStreamHandler.java:296)
    at com.google.apphosting.utils.security.urlfetch.URLFetchServiceStreamHandler$Connection.getResponseCode(URLFetchServiceStreamHandler.java:149)
    at com.google.gdata.client.GoogleAuthTokenFactory.makePostRequest(GoogleAuthTokenFactory.java:624)
    at com.google.gdata.client.GoogleAuthTokenFactory.getAuthToken(GoogleAuthTokenFactory.java:547)

有人遇到过这个问题吗?

【问题讨论】:

  • 它不时发生。 GAE 与身份验证基础设施有“私人”连接,有时会像这样超时。你只需要重试一切。

标签: java google-app-engine google-api-java-client picasa


【解决方案1】:

尝试增加超时。我在照片上传时遇到过这种情况,但在身份验证时没有。

我发现一张 500kb 的照片从我的开发 appengine 到 picacaweb 大约需要 17 秒,默认超时为 10 秒。尽管读取响应超时,但通常上传成功。最长为 60 秒,因此如果需要更长的时间,则需要采用不同的策略(上传/捕捉超时/检查照片是否存在/读取元数据或相应地重新上传)。

PicasawebService.setConnectTimeout(60000);
PicasawebService.setReadTimeout(60000);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-11-05
    • 2021-12-06
    • 2015-07-15
    • 2016-05-04
    • 2014-02-10
    • 2016-04-03
    • 2012-10-10
    相关资源
    最近更新 更多