gdata-java-client和google-api-java-client之间的不兼容问题 [英] Incompatibility issue between gdata-java-client and google-api-java-client

查看:79
本文介绍了gdata-java-client和google-api-java-client之间的不兼容问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个使用OAuth1和Google Analytics API版本2.3(使用来自gdata-java-client的gdata-analytics-2.1.jar)在App Engine上构建的应用.我们已经开始逐步更新我们的应用程序,以使用OAuth2和Core Reporting API v3.0.第一步,我们只希望允许我们的用户请求OAuth2令牌,而应用程序的其余部分将继续使用旧库.

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.

有关迁移到API Java客户端的Google文档( 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和google-api -java-client是两个完全不同的库,它们具有不同的程序包名称.这意味着您可以在项目中使用它们两者而不会发生冲突.新代码可以使用google-api-java-client,而旧代码可以继续使用gdata-java-client.这样可以提供一条平滑的迁移路径."

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

好吧,在进行了一些测试之后,我们注意到gdata-java-client和google-api-java-client之间存在不兼容问题.基本上,当我们包含"google-api-在WEB_INF/lib文件夹中的"services-analytics-v3-rev3-1.5.0-beta.zip"中,我们得到与gdata-java-client库相关的以下运行时错误:

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:无法初始化com.google.gdata.client.analytics.AnalyticsService类

有人遇到过这个吗?我们做错什么了吗? 提前非常感谢

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

推荐答案

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

这篇关于gdata-java-client和google-api-java-client之间的不兼容问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆