问题
We're using the following libraries:
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-bigquery</artifactId>
<version>v2-rev114-1.17.0-rc</version>
</dependency>
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-drive</artifactId>
<version>v2-rev98-1.17.0-rc</version>
</dependency>
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-oauth2</artifactId>
<version>v2-rev50-1.17.0-rc</version>
</dependency>
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client-jackson2</artifactId>
<version>1.13.1-beta</version>
</dependency>
<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client-appengine</artifactId>
<version>1.17.0-rc</version>
</dependency>
However, we're getting the following errors:
java.lang.NoClassDefFoundError: com/google/api/client/util/Lists
at com.google.api.client.auth.oauth2.Credential$Builder.<init>(Credential.java:625)
at com.google.api.client.googleapis.auth.oauth2.GoogleCredential$Builder.<init>(GoogleCredential.java:356)
at com.google.api.client.googleapis.auth.oauth2.GoogleCredential.<init>(GoogleCredential.java:193)
at com.xyz.getStoredCredentials(GoogleUserCredentialManager.java:155)
java.lang.NoClassDefFoundError: com/google/api/client/json/JsonObjectParser$Builder
at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient$Builder.<init>(AbstractGoogleJsonClient.java:74)
at com.google.api.services.bigquery.Bigquery$Builder.<init>(Bigquery.java:2913)
at com.abc.doPost(BigQuery.java:138)
So which libraries are we missing here?
回答1:
this change fixed it:
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client-jackson2</artifactId>
<version>1.17.0-rc</version>
</dependency>
来源:https://stackoverflow.com/questions/18817564/noclassdeffounderror-com-google-api-client-util-lists-when-setting-up-oauth2-on