Incompatibility issue between gdata-java-client an

2019-08-03 04:01发布

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条回答
Evening l夕情丶
2楼-- · 2019-08-03 04:10

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

查看更多
登录 后发表回答