Spanner Java客户端上的com.google.protobuf.AbstractMessage.newBuilderForType的NoSuchMethodError

时间:2017-03-20 20:33:24

标签: google-cloud-platform google-cloud-spanner

尝试通过运行示例代码试验Google的云扳手时出现此错误

https://github.com/GoogleCloudPlatform/java-docs-samples/blob/master/spanner/cloud-client/src/main/java/com/example/spanner/SpannerSample.java

堆栈跟踪如下:

Exception in thread "main" java.lang.NoSuchMethodError: com.google.protobuf.AbstractMessage.newBuilderForType(Lcom/google/protobuf/AbstractMessage$BuilderParent;)Lcom/google/protobuf/Message$Builder;
at com.google.protobuf.SingleFieldBuilderV3.getBuilder(SingleFieldBuilderV3.java:142)
at com.google.spanner.v1.Mutation$Builder.getInsertBuilder(Mutation.java:3227)
at com.google.cloud.spanner.Mutation.toProto(Mutation.java:377)
at com.google.cloud.spanner.SpannerImpl$TransactionContextImpl.commit(SpannerImpl.java:1223)
at com.google.cloud.spanner.SpannerImpl$TransactionRunnerImpl.run(SpannerImpl.java:1148)
at com.google.cloud.spanner.SpannerImpl$SessionImpl.write(SpannerImpl.java:704)
at com.google.cloud.spanner.SessionPool$PooledSession.write(SessionPool.java:201)
at com.google.cloud.spanner.DatabaseClientImpl.write(DatabaseClientImpl.java:31)
at spanner_test.SpannerSample.writeExampleData(SpannerSample.java:164)
at spanner_test.SpannerSample.run(SpannerSample.java:423)
at spanner_test.SpannerSample.main(SpannerSample.java:501)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

我正在使用gradle,我的依赖关系如下:

扳手:

com.google.cloud:google-cloud-spanner:0.9.4-beta'

protobuf的:

com.google.protobuf:protobuf-java:3.1.0

0 个答案:

没有答案