在GAE中使用PicasawebService时出错 [英] Error while using PicasawebService with GAE

查看:139
本文介绍了在GAE中使用PicasawebService时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  PicasawebService myService 

我的GAE应用程序连接到picassa webalbum,但我无法进行身份验证。 =新的PicasawebService(myclub);
myService.setUserCredentials(username@gmail.com,my_password);

我得到的错误是

<$ p $在com.google.gdata.client.GoogleAuthTokenFactory.getAuthToken(GoogleAuthTokenFactory.java:549)
上连接登录URI
时发生错误

com.google.gdata.util.AuthenticationException: com.google.gdata.client.GoogleAuthTokenFactory.setUserCredentials(GoogleAuthTokenFactory.java:397)
,com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:364)
,com.google .gdata.client.GoogleService.setUserCredentials(GoogleService.java:319)
,位于com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:303)


导致:java.net.SocketTimeoutException:获取时超时:https://www.google.com/accounts/ClientLogin
com.google.appengine.api.urlfetch.URLFetchServiceImpl.fetch(URLFetchServiceImpl.java:52 )
,位于com.google.apphosting.utils.security.urlfetch.URLFetchServiceStreamHandler $ Connection.fetchResponse (URLFetchServiceStreamHandler.java:417)
,位于com.google.apphosting.utils.security.urlfetch.URLFetchServiceStreamHandler $ Connection.getInputStream(URLFetchServiceStreamHandler.java:296)
,位于com.google.apphosting.utils.security .urlfetch.URLFetchServiceStreamHandler $ Connection.getResponseCode(URLFetchServiceStreamHandler.java:149)
,位于com.google.gdata.client.GoogleAuthTokenFactory.makePostRequest(GoogleAuthTokenFactory.java:624)
,位于com.google.gdata.client .GoogleAuthTokenFactory.getAuthToken(GoogleAuthTokenFactory.java:547)

有没有人遇到过这个问题?

解决方案

尝试增加超时时间。我发现照片上传虽然没有进行身份验证。



我发现从我的开发appengine到picacaweb的500kb照片大约需要17s,默认超时时间为10s。通常,尽管读取响应超时,上传仍然成功。 60s是最大的,所以如果花费时间比这更长,则需要不同的策略(上传/捕获超时/检查照片存在/读取元数据或相应地重新上传)。

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


I am trying to connect to picassa webalbum from my GAE application.But I am not able to authenticate.

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

The error im getting is

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)

Has anyone faced this issue?

解决方案

Try increasing the timeout. I experienced this on photo upload though not on authentication.

I found it took about 17s for a 500kb photo from my development appengine to picacaweb, the default timeout is 10s. Usually the upload has succeeded despite the timeout on reading the response. 60s is the maximum so if it takes longer than this a different strategy will be necessary (Upload / catch timeout / check for photo presence / read metadata or re-upload accordingly).

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

这篇关于在GAE中使用PicasawebService时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆