google-app-enginegoogle-mirror-apigoogle-glass

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)

Solution

  • 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.