问题
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?
回答1:
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);
来源:https://stackoverflow.com/questions/19320768/error-while-using-picasawebservice-with-gae