Incompatibility issue between gdata-java-client and google-api-java-client

烈酒焚心 提交于 2019-12-11 04:47:34

问题


We have an app built on App Engine using OAuth1 and the Google Analytics API version 2.3 (using gdata-analytics-2.1.jar from the gdata-java-client). We have started to gradually update our app to use OAuth2 and the Core Reporting API v3.0. In the first step we just want to allow our users to request OAuth2 tokens, while the rest of the application will keep on using the old libraries.

According to Google documentation when it comes to migrate to API Java client (http://code.google.com/p/gdata-java-client/wiki/MigratingToGoogleApiJavaClient#What_if_I_have_a_large_code_base_that_uses_gdata-java-client?), “gdata-java-client and google-api-java-client are two completely different libraries with different package names. That means you can use both of them in your project without conflict. New code can use google-api-java-client and old code can continue to use gdata-java-client. This can provide a smooth migration path.”

Well, after making a few tests we have noticed an incompatibility issue between gdata-java-client and google-api-java-client. Basically, when we include either “google-api-analytics-v3-rev3-java-1.5.0-beta.jar” or “google-api-client-1.8.0-beta.jar” libraries from “google-api-services-analytics-v3-rev3-1.5.0-beta.zip” in the WEB_INF/lib folder, we get the following runtime error related with the gdata-java-client library:

java.lang.NoClassDefFoundError: Could not initialize class com.google.gdata.client.analytics.AnalyticsService

Has anyone faced this? Are we doing anything wrong? Many thanks in advance


回答1:


Download gdata-src.java-1.XX.X.zip from http://code.google.com/p/gdata-java-client/downloads/list and look for java/lib/gdata-analytics*.jar, which need to go in the WEB-INF/lib folder. That's the jar that contains com.google.gdata.client.analytics.AnalyticsService



来源:https://stackoverflow.com/questions/10269451/incompatibility-issue-between-gdata-java-client-and-google-api-java-client

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!