0

我试图使用的Cloud Bigtable版API,虽然我知道它在我的Apache梁的工作,当我尝试使用API​​直接我遇到这样的错误:GoogleCredentialas.getApplicationDefault的NoSuchMethodError

Caused by: java.lang.NoSuchMethodError: com.google.auth.oauth2.GoogleCredentials.getApplicationDefault(Lcom/google/api/client/http/HttpTransport;)Lcom/google/auth/oauth2/GoogleCredentials; 
at com.google.cloud.bigtable.config.CredentialFactory.getApplicationDefaultCredential(CredentialFactory.java:207) 
at com.google.cloud.bigtable.config.CredentialFactory.getCredentials(CredentialFactory.java:112) 
at com.google.cloud.bigtable.grpc.io.CredentialInterceptorCache.getCredentialsInterceptor(CredentialInterceptorCache.java:94) 
at com.google.cloud.bigtable.grpc.BigtableSession.<init>(BigtableSession.java:272) 

我知道这是某种Maven /依赖相关的问题,但我对maven和java很陌生,所以我不知道如何去调试它。

如何对此进行分类?

[INFO] +- org.apache.beam:beam-sdks-java-core:jar:0.6.0:compile 
[INFO] | +- org.apache.beam:beam-sdks-common-runner-api:jar:0.6.0:compile 
[INFO] | +- io.grpc:grpc-auth:jar:1.0.1:compile 
[INFO] | +- io.grpc:grpc-core:jar:1.0.1:compile 
[INFO] | | \- io.grpc:grpc-context:jar:1.0.1:compile 
[INFO] | +- io.grpc:grpc-netty:jar:1.0.1:compile 
[INFO] | | \- io.netty:netty-codec-http2:jar:4.1.3.Final:compile (version selected from constraint [4.1.3.Final,4.1.3.Final]) 
[INFO] | |  \- io.netty:netty-codec-http:jar:4.1.3.Final:compile 
[INFO] | +- io.grpc:grpc-stub:jar:1.0.1:compile 
[INFO] | +- io.grpc:grpc-all:jar:1.0.1:runtime 
[INFO] | | +- io.grpc:grpc-protobuf:jar:1.0.1:compile 
[INFO] | | | \- com.google.protobuf:protobuf-java-util:jar:3.0.0:compile 
[INFO] | | |  \- com.google.code.gson:gson:jar:2.3:compile 
[INFO] | | +- io.grpc:grpc-protobuf-nano:jar:1.0.1:runtime 
[INFO] | | | \- com.google.protobuf.nano:protobuf-javanano:jar:3.0.0-alpha-5:runtime 
[INFO] | | \- io.grpc:grpc-okhttp:jar:1.0.1:runtime 
[INFO] | |  +- com.squareup.okio:okio:jar:1.6.0:runtime 
[INFO] | |  \- com.squareup.okhttp:okhttp:jar:2.5.0:runtime 
[INFO] | +- io.grpc:grpc-protobuf-lite:jar:1.0.1:compile 
[INFO] | +- com.google.protobuf:protobuf-lite:jar:3.0.1:compile 
[INFO] | +- com.google.auth:google-auth-library-credentials:jar:0.6.0:compile 
[INFO] | +- com.google.auth:google-auth-library-oauth2-http:jar:0.6.0:compile 
[INFO] | +- io.netty:netty-handler:jar:4.1.3.Final:compile 
[INFO] | | +- io.netty:netty-buffer:jar:4.1.3.Final:compile 
[INFO] | | | \- io.netty:netty-common:jar:4.1.3.Final:compile 
[INFO] | | +- io.netty:netty-transport:jar:4.1.3.Final:compile 
[INFO] | | | \- io.netty:netty-resolver:jar:4.1.3.Final:compile 
[INFO] | | \- io.netty:netty-codec:jar:4.1.3.Final:compile 
[INFO] | +- com.google.api.grpc:grpc-google-pubsub-v1:jar:0.1.0:compile 
[INFO] | | +- com.google.api.grpc:grpc-google-common-protos:jar:0.1.0:compile 
[INFO] | | \- com.google.api.grpc:grpc-google-iam-v1:jar:0.1.0:compile 
[INFO] | +- com.google.apis:google-api-services-cloudresourcemanager:jar:v1-rev6-1.22.0:compile 
[INFO] | +- com.google.apis:google-api-services-storage:jar:v1-rev71-1.22.0:compile 
[INFO] | +- com.google.http-client:google-http-client-jackson:jar:1.22.0:compile 
[INFO] | +- com.google.http-client:google-http-client-jackson2:jar:1.22.0:compile 
[INFO] | +- com.google.http-client:google-http-client-protobuf:jar:1.22.0:compile 
[INFO] | +- com.google.oauth-client:google-oauth-client:jar:1.22.0:compile 
[INFO] | +- com.google.cloud.bigdataoss:gcsio:jar:1.4.5:compile 
[INFO] | | +- com.google.api-client:google-api-client-java6:jar:1.20.0:compile 
[INFO] | | +- com.google.api-client:google-api-client-jackson2:jar:1.20.0:compile 
[INFO] | | \- com.google.oauth-client:google-oauth-client-java6:jar:1.20.0:compile 
[INFO] | +- com.google.cloud.bigdataoss:util:jar:1.4.5:compile 
[INFO] | +- com.google.protobuf:protobuf-java:jar:3.1.0:compile 
[INFO] | +- com.google.code.findbugs:jsr305:jar:3.0.1:compile 
[INFO] | +- com.fasterxml.jackson.core:jackson-core:jar:2.7.2:compile 
[INFO] | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.7.2:compile 
[INFO] | +- com.fasterxml.jackson.core:jackson-databind:jar:2.7.2:compile 
[INFO] | +- net.bytebuddy:byte-buddy:jar:1.6.8:compile 
[INFO] | +- org.apache.avro:avro:jar:1.8.1:compile 
[INFO] | | +- org.codehaus.jackson:jackson-core-asl:jar:1.9.13:compile 
[INFO] | | +- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.13:compile 
[INFO] | | +- com.thoughtworks.paranamer:paranamer:jar:2.7:compile 
[INFO] | | \- org.tukaani:xz:jar:1.5:compile 
[INFO] | +- org.xerial.snappy:snappy-java:jar:1.1.2.1:compile 
[INFO] | +- org.apache.commons:commons-compress:jar:1.9:compile 
[INFO] | \- org.apache.commons:commons-lang3:jar:3.5:compile 
[INFO] +- org.apache.beam:beam-sdks-java-io-google-cloud-platform:jar:0.6.0:compile 
[INFO] | +- com.google.cloud.datastore:datastore-v1-proto-client:jar:1.4.0:compile 
[INFO] | +- com.google.cloud.datastore:datastore-v1-protos:jar:1.3.0:compile 
[INFO] | +- com.google.cloud.bigtable:bigtable-protos:jar:0.9.2:compile 
[INFO] | +- com.google.cloud.bigtable:bigtable-client-core:jar:0.9.2:compile 
[INFO] | | +- commons-logging:commons-logging:jar:1.2:compile 
[INFO] | | +- com.google.auth:google-auth-library-appengine:jar:0.4.0:compile 
[INFO] | | | \- com.google.appengine:appengine-api-1.0-sdk:jar:1.9.34:compile 
[INFO] | | \- io.dropwizard.metrics:metrics-core:jar:3.1.2:compile 
[INFO] | \- io.netty:netty-tcnative-boringssl-static:jar:1.1.33.Fork18:runtime 
[INFO] +- org.apache.beam:beam-sdks-java-extensions-json-jackson:jar:0.6.0:compile 
[INFO] +- com.google.api-client:google-api-client:jar:1.22.0:compile 
[INFO] +- com.google.apis:google-api-services-bigquery:jar:v2-rev295-1.22.0:compile 
[INFO] +- com.google.http-client:google-http-client:jar:1.22.0:compile 
[INFO] | \- org.apache.httpcomponents:httpclient:jar:4.0.1:compile 
[INFO] |  +- org.apache.httpcomponents:httpcore:jar:4.0.1:compile 
[INFO] |  \- commons-codec:commons-codec:jar:1.3:compile 
[INFO] +- com.google.apis:google-api-services-pubsub:jar:v1-rev10-1.22.0:compile 
[INFO] +- joda-time:joda-time:jar:2.4:compile 
[INFO] +- com.google.cloud:google-cloud-storage:jar:0.10.0-beta:compile 
[INFO] | \- com.google.cloud:google-cloud-core:jar:0.10.0-alpha:compile 
[INFO] |  +- com.google.api-client:google-api-client-appengine:jar:1.21.0:compile 
[INFO] |  | +- com.google.oauth-client:google-oauth-client-appengine:jar:1.21.0:compile 
[INFO] |  | | +- com.google.oauth-client:google-oauth-client-servlet:jar:1.21.0:compile 
[INFO] |  | | | \- com.google.http-client:google-http-client-jdo:jar:1.21.0:compile 
[INFO] |  | | \- javax.servlet:servlet-api:jar:2.5:compile 
[INFO] |  | +- com.google.api-client:google-api-client-servlet:jar:1.21.0:compile 
[INFO] |  | | \- javax.jdo:jdo2-api:jar:2.3-eb:compile 
[INFO] |  | |  \- javax.transaction:transaction-api:jar:1.1:compile 
[INFO] |  | \- com.google.http-client:google-http-client-appengine:jar:1.21.0:compile 
[INFO] |  +- org.json:json:jar:20151123:compile 
[INFO] |  \- com.google.api:gax:jar:0.4.0:compile 
[INFO] |  +- com.google.inject:guice:jar:4.0:compile 
[INFO] |  | +- javax.inject:javax.inject:jar:1:compile 
[INFO] |  | \- aopalliance:aopalliance:jar:1.0:compile 
[INFO] |  \- com.google.auto.value:auto-value:jar:1.2:compile 
[INFO] +- com.google.guava:guava:jar:21.0:compile 
[INFO] +- eu.bitwalker:UserAgentUtils:jar:1.20:compile 
[INFO] +- org.slf4j:slf4j-api:jar:1.7.14:compile 
[INFO] +- org.slf4j:slf4j-jdk14:jar:1.7.14:runtime 
[INFO] +- org.hamcrest:hamcrest-all:jar:1.3:compile 
[INFO] +- junit:junit:jar:4.12:compile 
[INFO] | \- org.hamcrest:hamcrest-core:jar:1.3:compile 
[INFO] +- org.apache.beam:beam-runners-direct-java:jar:0.6.0:runtime 
[INFO] | +- org.apache.beam:beam-runners-core-construction-java:jar:0.6.0:runtime 
[INFO] | \- org.apache.beam:beam-runners-core-java:jar:0.6.0:runtime 
[INFO] \- org.apache.beam:beam-sdks-java-io-kafka:jar:0.6.0:compile 
[INFO] +- org.apache.kafka:kafka-clients:jar:0.9.0.1:compile 
[INFO] | \- net.jpountz.lz4:lz4:jar:1.2.0:compile 
[INFO] \- org.springframework:spring-expression:jar:4.3.5.RELEASE:compile 
[INFO]  \- org.springframework:spring-core:jar:4.3.5.RELEASE:compile 

回答

1

0.9.2客户端使用谷歌认证 - 库的oauth2-HTTP(0.4.0)比梁SDK(0.6.0)的旧版本。 GoogleCredentials对象似乎在版本之间发生了变化。

Beam SDK将在不久的将来使用0.9.6 cloud-bigtable-client,它应该解决这个问题。

或者,您可以使用HBase oriented CloudBigtableIO connector,它隐藏依赖关系,并且没有此特定问题。