somethinAboutEd
somethinAboutEd

Reputation: 1

io.grpc.StatusRuntimeException: UNIMPLEMENTED: Method not found: chat.example.ChatService/chat

I have reviewed other posts where the subject line's error is mentioned, but none of these have helped. I have the server in one project and the client in another.

This is my Chat.proto file for both, they're identical:

syntax = "proto3";

import "google/protobuf/timestamp.proto";
package chat.example;

message ChatMessage {
    string from = 1;
    string message = 2;
}

message ChatMessageFromServer {
    google.protobuf.Timestamp timestamp = 1;
    ChatMessage message = 2;
}

service ChatService {
    rpc chat(stream ChatMessage) returns (stream ChatMessageFromServer);
}

The server is being run on http://localhost:50051. The client appears to be connecting to the server but then I get the following error:

io.grpc.StatusRuntimeException: UNIMPLEMENTED: Method not found: chat.example.ChatService/chat
Disconnected
        at io.grpc.Status.asRuntimeException(Status.java:532)
        at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:481)
        at io.grpc.internal.DelayedClientCall$DelayedListener$3.run(DelayedClientCall.java:489)
        at io.grpc.internal.DelayedClientCall$DelayedListener.delayOrExecute(DelayedClientCall.java:453)
        at io.grpc.internal.DelayedClientCall$DelayedListener.onClose(DelayedClientCall.java:486)
        at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:564)
        at io.grpc.internal.ClientCallImpl.access$100(ClientCallImpl.java:72)
        at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:729)
        at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:710)
        at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
        at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
        at java.base/java.lang.Thread.run(Thread.java:1575)

But the method is defined in both projects, with same package, in the generated class ChatServiceGrpc.java:

public static final java.lang.String SERVICE_NAME = "chat.example.ChatService";

  // Static method descriptors that strictly reflect the proto.
  private static volatile io.grpc.MethodDescriptor<chat.example.Chat.ChatMessage,
      chat.example.Chat.ChatMessageFromServer> getChatMethod;

  @io.grpc.stub.annotations.RpcMethod(
      fullMethodName = SERVICE_NAME + '/' + "chat",

Anyone have an idea of where to point me?

Originally, the Chat.proto files had different names, resulting in different method names as well. Additionally, I had these under different packages but I have now made them the same.

When I run netstat -ano | findstr: 50051 , I get the following in the command prompt:

  TCP    0.0.0.0:50051          0.0.0.0:0              LISTENING       33960
  TCP    127.0.0.1:50051        127.0.0.1:57252        ESTABLISHED     33960
  TCP    127.0.0.1:57252        127.0.0.1:50051        ESTABLISHED     28372
  TCP    [::]:50051             [::]:0                 LISTENING       33960

This seems to demonstrate to me that a connection is being established between client and server. I am not, however, getting the service behaviour as defined by the .proto file and the Method not found error is occurring.

Upvotes: 0

Views: 35

Answers (0)

Related Questions