2
votes

Trying to run the Google drive sample I always get the error explained below. I checked the configuration and it looks correct. Last releases of appengine eclipse plugin is been used. The error thrown looks as if the method : com.google.api.client.http.HttpRequestFactory.buildRequest is not available at runtime. This is a deprecated method but no error is given at compile time. Has anybody encountered the same situation ?

012-12-16 08:52:01.050 Uncaught exception from servlet

    java.lang.NoSuchMethodError: com.google.api.client.http.HttpRequestFactory.buildRequest(Ljava/lang/String;Lcom/google/api/client/http/GenericUrl;Lcom/google/api/client/http/HttpContent;)Lcom/google/api/client/http/HttpRequest;
    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.buildHttpRequest(AbstractGoogleClientRequest.java:290)
    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:396)
    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:328)
    at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:449)
    at it.contextsolutions.drived.CredentialMediator.getUserInfo(CredentialMediator.java:211)
    at it.contextsolutions.drived.CredentialMediator.getActiveCredential(CredentialMediator.java:312)
    at it.contextsolutions.drived.DrEditServlet.getCredentialMediator(DrEditServlet.java:98)
    at it.contextsolutions.drived.DrEditServlet.getClientId(DrEditServlet.java:143)
    at it.contextsolutions.drived.StartPageServlet.doGet(StartPageServlet.java:46)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)     
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)     
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
    "
2
This cannot be read. Please modify it by adding links to the said sample, tell about your environment and put the code in code quotes.Arnaud Rinquin
I tried updating the sdk to the latest version and that helped.user1929682

2 Answers

1
votes

problem is in fact drEdit sample still has GAE 1.6.3 version libraries, and you added GAE API (and drive/oauth2 api) from newer version.

Just check sources of your project under web/WEB-INF/lib - you will have many dublications of same jars, but different versions:

  • appengine-api-xxx-1.6.3 (got from drEdit sources) and appengine-api-xxx-1.7.4 (added by Google plugin in Eclipse)
  • google-api-client-xxx-1.10.3-beta.jar (got from drEdit sources) and google-api-client-xxx-1.12.0-beta (added by Eclipse plugin)
  • google-api-services-xxx-1.7.2-beta (got from drEdit sources) and google-api-services-xxx-1.12.0-beta (added by Eclipse plugin).

Simple clean you web/WEB-INF/lib folder by removing old versions of jar - in my case it helped.

0
votes

My way to make it work:

check out the google-drive-sdk-samples, copy it to your workspace, but delete all out-of-date libraries in WEB-INF/lib.

Add Drive-SDK and OAuth2 API, this will automatically add all required library files to WEB-INF/lib.

Now your library is consistent and you are good to go!