Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The API package 'urlfetch' or call 'Fetch()' was not found

I am very new to Google App Engine (GAE) and Glassware development (for Google Glass).

I configured mirror-quickstart-java project on Netbeans and Apache tomcat also I was successful in running the project but I am having trouble ahead.

My requirement is, I don't want to use google app engine for the development of my own Glassware as I want to use few third party APIs. Also the app engine doesn't support javax.imageio and BufferedImage apis.

I have following questions in mind

  1. Is is compulsory to use Google app-engine for mirror-quickstart-java/Glassware development?
  2. If not, I am getting the following error after "Allow access" step while exchanging access tokens.
message The API package 'urlfetch' or call 'Fetch()' was not found.

description The server encountered an internal error that prevented it from fulfilling this request.

com.google.apphosting.api.ApiProxy$CallNotFoundException: The API package 'urlfetch' or call 'Fetch()' was not found.
    com.google.apphosting.api.ApiProxy.makeSyncCall(ApiProxy.java:100)
    com.google.appengine.api.urlfetch.URLFetchServiceImpl.fetch(URLFetchServiceImpl.java:38)
    com.google.api.client.extensions.appengine.http.UrlFetchRequest.execute(UrlFetchRequest.java:75)
    com.google.api.client.http.HttpRequest.execute(HttpRequest.java:980)
    com.google.api.client.auth.oauth2.TokenRequest.executeUnparsed(TokenRequest.java:299)
    com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeTokenRequest.execute(GoogleAuthorizationCodeTokenRequest.java:175)
    com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeTokenRequest.execute(GoogleAuthorizationCodeTokenRequest.java:78)
    com.google.glassware.AuthServlet.doGet(AuthServlet.java:56)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
like image 626
Vishal Vyas Avatar asked May 30 '13 10:05

Vishal Vyas


2 Answers

Moving the quick start project from App Engine to another J2EE container is pretty straight forward, but it does require some code changes:

  1. Replace instances of UrlFetchTransport with an alternative like NetHttpTransport. This will impact AuthUtil.java and MirrorClient.java
  2. Replace ListableAppEngineCredentialStore.java with a new implementation of CredentialStore that works with whatever persistence layer you prefer (Hibernate, SQLite, etc).

There are also some changes you need to make to the dependency management and build scripts, but you're on your own there since that depends a lot on how you plan to run it.

like image 86
mimming Avatar answered Nov 23 '22 13:11

mimming


It is not required to use appengine for your Glassware. The only requirement is that subscription replies will be sent to you using HTTPS, so you will need to make sure your server is correctly configured to handle this.

The urlfetch package is specific to appengine. You should make sure the appengine libraries are removed from your project and any code that references it is re-written to use the standard java.net libraries. Since this is part of the authentication, you may want to use an alternative OAuth2 method such as Google+ Sign-In.

like image 20
Prisoner Avatar answered Nov 23 '22 13:11

Prisoner