#protocol-buffers #grpc #protobuf-java
Вопрос:
io.grpc.StatusRuntimeException: CANCELLED: Failed to read message.
at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:244)
at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:225)
at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:142)
at com.xyz.orderplatform.order.v1.OrderServiceAPIGrpc$OrderServiceAPIBlockingStub.getOrderById(OrderServiceAPIGrpc.java:413)
at com.xyz.sgflume.transformers.order_helper.OrderServiceClient.getOrderById(OrderServiceClient.java:16)
at com.xyz.sgflume.transformers.services.OrderService.getOrderData(OrderService.java:55)
at com.xyz.sgflume.transformers.de.governance.actioning.ActionCommunicationDeserializer.getOrderDataForEvent(ActionCommunicationDeserializer.java:68)
at com.xyz.sgflume.transformers.de.governance.actioning.ActionCommunicationDeserializer.transform(ActionCommunicationDeserializer.java:32)
at com.xyz.sgflume.transformers.de.governance.actioning.ActionCommunicationDeserializer.transform(ActionCommunicationDeserializer.java:73)
at org.apache.flume.sink.http.HttpPooledSink.lambda$process$1(HttpPooledSink.java:256)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.xyz.orderplatform.order.v1.AddnOrderInfo$PricingOptionsDefaultEntryHolder
at com.xyz.orderplatform.order.v1.AddnOrderInfo.<init>(AddnOrderInfo.java:110)
at com.xyz.orderplatform.order.v1.AddnOrderInfo.<init>(AddnOrderInfo.java:14)
at com.xyz.orderplatform.order.v1.AddnOrderInfo$1.parsePartialFrom(AddnOrderInfo.java:2191)
at com.xyz.orderplatform.order.v1.AddnOrderInfo$1.parsePartialFrom(AddnOrderInfo.java:2185)
at com.google.protobuf.CodedInputStream$ArrayDecoder.readMessage(CodedInputStream.java:883)
at com.xyz.orderplatform.order.v1.Order.<init>(Order.java:274)
at com.xyz.orderplatform.order.v1.Order.<init>(Order.java:15)
at com.xyz.orderplatform.order.v1.Order$1.parsePartialFrom(Order.java:5208)
at com.xyz.orderplatform.order.v1.Order$1.parsePartialFrom(Order.java:5202)
at com.google.protobuf.CodedInputStream$ArrayDecoder.readMessage(CodedInputStream.java:883)
at com.xyz.orderplatform.order.v1.GetOrderByIdResponse.<init>(GetOrderByIdResponse.java:74)
at com.xyz.orderplatform.order.v1.GetOrderByIdResponse.<init>(GetOrderByIdResponse.java:13)
at com.xyz.orderplatform.order.v1.GetOrderByIdResponse$1.parsePartialFrom(GetOrderByIdResponse.java:921)
at com.xyz.orderplatform.order.v1.GetOrderByIdResponse$1.parsePartialFrom(GetOrderByIdResponse.java:915)
at com.google.protobuf.AbstractParser.parseFrom(AbstractParser.java:86)
at com.google.protobuf.AbstractParser.parseFrom(AbstractParser.java:48)
at io.grpc.protobuf.lite.ProtoLiteUtils$MessageMarshaller.parseFrom(ProtoLiteUtils.java:223)
at io.grpc.protobuf.lite.ProtoLiteUtils$MessageMarshaller.parse(ProtoLiteUtils.java:215)
at io.grpc.protobuf.lite.ProtoLiteUtils$MessageMarshaller.parse(ProtoLiteUtils.java:118)
at io.grpc.MethodDescriptor.parseResponse(MethodDescriptor.java:273)
at io.grpc.MethodDescriptor.parseResponse(MethodDescriptor.java:273)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1MessagesAvailable.runInternal(ClientCallImpl.java:658)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1MessagesAvailable.runInContext(ClientCallImpl.java:643)
at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123)
at io.grpc.stub.ClientCalls$ThreadlessExecutor.waitAndDrain(ClientCalls.java:694)
at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:135)
... 12 common frames omitted
Я вижу, что сервер вернул ответ, но клиент не может его проанализировать, столкнувшись с указанным выше исключением.
Вот прото AddnOrderInfo, в котором, похоже, возникает проблема:
message AddnOrderInfo{
string vendor_placement_status = 1 [deprecated=true];
bool is_reorder_allowed = 2 [deprecated=true];
bool is_edit_allowed = 3 [deprecated=true];
string cart_id = 4;
CloneInfo clone_info = 5 ;
EditInfo edit_info = 6;
map<string, google.protobuf.Any> pricing_options = 7 [deprecated=true];
google.type.Money order_incoming = 8;
bool is_customers_first_order = 9 [deprecated=true];
repeated string order_tags = 10;
google.type.Money cancellation_refund_amount = 11;
}
К вашему сведению — импортировали прототипы через зависимость maven, и файлы классов присутствуют в пути к классам. Заранее спасибо за понимание.
Комментарии:
1. Возможно, вы захотите попробовать перекомпилировать протос.