带有数据流的grpc-java.lang.NoSuchMethodError [英] grpc with dataflow - java.lang.NoSuchMethodError

查看:266
本文介绍了带有数据流的grpc-java.lang.NoSuchMethodError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用maven protoc插件0.4.2和grpc版本0.8.0编译的grpc服务代码.我正在尝试将生成的代码与datafflow sdk 1.4.0结合使用,但是当我尝试使用阻塞存根创建grpc客户端时出现此错误.

I have a grpc service code compiled with maven protoc plugin 0.4.2 and grpc version 0.8.0. I am trying to use this generated code with datafflow sdk 1.4.0 but I get this error when i try to create a grpc client using the blocking stub.

com.google.cloud.dataflow.sdk.Pipeline$PipelineExecutionException: java.lang.NoSuchMethodError: io.grpc.protobuf.ProtoUtils.marshaller(Lcom/google/protobuf/MessageLite;)Lio/grpc/MethodDescriptor$Marshaller;
    at com.google.cloud.dataflow.sdk.Pipeline.run(Pipeline.java:186)

我不确定这是否是由于数据流sdk使用的protobuf版本与grpc生成的代码之间存在一些差异. 当我尝试从管道中的其中一个DoFn输出protobuf消息时,也会收到此错误

I am not sure if this is because of some discrepancy with between the versions of protobuf used by the dataflow sdk and the grpc generated code. I also get this error when i try to output a protobuf message from one of the DoFn's in my pipeline

com.google.cloud.dataflow.sdk.Pipeline$PipelineExecutionException: java.lang.NoSuchMethodError: com.google.protobuf.GeneratedMessage.computeStringSize(ILjava/lang/Object;)I
    at com.google.cloud.dataflow.sdk.Pipeline.run(Pipeline.java:186)

我已将protobuf从maven的数据流sdk依赖中排除,并且在我的依赖树中显示的唯一protobuf和groc软件包分别是3.0.0-alpha-3.1和0.8.0.

I have excluded protobuf from the dataflow sdk dependency in maven and the only protobuf and groc packages that show up in my dependency tree are 3.0.0-alpha-3.1 and 0.8.0 respectively.

推荐答案

ProtoUtils.marshaller(MessageLite)已添加到grpc-java 0.9.0中; grpc-java 0.8.0改用了Parser对象.尝试更新您的grpc-java版本.

ProtoUtils.marshaller(MessageLite) was added in grpc-java 0.9.0; grpc-java 0.8.0 used a Parser object instead. Try updating your grpc-java version.

protobuf也有类似问题.该方法已添加到v3.0.0-alpha-4.

It's a similar issue with protobuf. The method was added in v3.0.0-alpha-4.

这篇关于带有数据流的grpc-java.lang.NoSuchMethodError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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