Grpc.Core.RpcException method is unimplemented with C# client and Java Server

I am having trouble finding the source of this error. I implemented a simple service using protobuf:

syntax = "proto3";

package tourism;

service RemoteService {
  rpc Login(LoginUserDTO) returns (Response) {}

message AgencyDTO{
  int32 id=1;
  string name=2;
  string email=3;
  string password=4;

message LoginUserDTO{
  string password=1;
  string email=2;

message SearchAttractionsDTO{
  string name=1;
  int32 start_hour=2;
  int32 start_minute=3;
  int32 stop_hour=4;
  int32 stop_minute=5;
  AgencyDTO loggedUser=6;

message AttractionDTO{
  int32 id=1;
  string name=2;
  string agency=3;
  int32 hour=4;
  int32 minute=5;
  int32 seats=6;
  int32 price=7;

message ReservationDTO{
  int32 id=1;
  string first_name=2;
  string last_name=3;
  string phone=4;
  int32 seats=5;
  AttractionDTO attraction=6;
  AgencyDTO agency=7;

message Response{
  enum ResponseType{
  ResponseType type=1;
  AgencyDTO user=2;
  string message=3;

When using a java client everything works fine, the server receives the request and responds appropriately. When using C# with the same .proto file for generating sources at the client.Login() I get the following errror: Grpc.Core.RpcException Status(StatusCode=Unimplemented, Detail=”Method tourism.RemoteService/Login is unimplemented”). The server receives the request but does not have time to respond and throws:

INFO: Request from [email protected]
May 22, 2017 12:28:58 AM io.grpc.internal.SerializingExecutor run
SEVERE: Exception while executing runnable[email protected]4be43082
java.lang.IllegalStateException: call is closed
    at io.grpc.internal.ServerCallImpl.sendHeaders(
    at io.grpc.stub.ServerCalls$ServerCallStreamObserverImpl.onNext(
    at ServiceImp.login(
    at tourism.RemoteServiceGrpc$MethodHandlers.invoke(
    at io.grpc.stub.ServerCalls$1$1.onHalfClose(
    at io.grpc.internal.ServerCallImpl$ServerStreamListenerImpl.halfClosed(
    at io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener$2.runInContext(
    at java.util.concurrent.ThreadPoolExecutor.runWorker(
    at java.util.concurrent.ThreadPoolExecutor$

Java server:

import io.grpc.Server;
import io.grpc.ServerBuilder;
import io.grpc.stub.StreamObserver;
import tourism.RemoteServiceGrpc;
import tourism.Service;

import java.util.logging.Level;
import java.util.logging.Logger;

 * Created by Andu on 21/05/2017.
public class ServerGrpc {
    Logger logger= Logger.getLogger(ServerGrpc.class.getName());
    private final Server server;
    private final int port;

    public ServerGrpc(int p){
        server= ServerBuilder.forPort(port).addService(new ServiceImp()).build();

    public void start() throws IOException {
        server.start();"Server started, listening on " + port);
        Runtime.getRuntime().addShutdownHook(new Thread() {
            public void run() {
                // Use stderr here since the logger may has been reset by its JVM shutdown hook.
                System.err.println("*** shutting down gRPC server since JVM is shutting down");
                System.err.println("*** server shut down");

    public void stop() {
        if (server != null) {

    void blockUntilShutdown() throws InterruptedException {
        if (server != null) {

    private class ServiceImp extends RemoteServiceGrpc.RemoteServiceImplBase {
        Logger log=Logger.getLogger(ServiceImp.class.getName());

        public void login(Service.LoginUserDTO request, StreamObserver<Service.Response> responseStreamObserver){
            log.log(Level.INFO,"Request from "+request.getEmail());
            Service.Response response= Service.Response.newBuilder().setMessage("Hello "+request.getEmail()+", I know your password: "+request.getPassword()).build();


C# Client:

namespace testGrpc2
    class MainClass
        public static void Main(string[] args)
            var channel = new Channel("",ChannelCredentials.Insecure);
            var client = new RemoteService.RemoteServiceClient(channel);
            Response response=client.Login(new LoginUserDTO{Email="[email protected]",Password="notmypassword"});


I managed to find the source of the problem. For anyone else having this problem:

Make sure your .proto file is identical for both client and server and it has the same package. When the client calls a method on the remote server, it uses the full name of the remote class and the package.

However this was not the reason why the method appeared as unimplemented to the client. It was this:


Calling the super method login sends an async UNIMPLEMENTED error code back to the client. This is the login() method in the generated class:

public void login(LoginUserDTO request,StreamObserver<Response> responseObserver) {
          asyncUnimplementedUnaryCall(METHOD_LOGIN, responseObserver);

So make sure in the implementation of your service methods you don’t call the super method as it will appear to the client as UNIMPLEMENTED. If you generate @Override methods using IntelliJ IDEA it will add the super method call. Make sure to delete it.

Leave a Reply

Your email address will not be published. Required fields are marked *