io.grpc.StatusRuntimeException: UNIMPLEMENTED: Method not found

48
May 18, 2019, at 11:00 PM

Using Springboot starter app. Everything working. Then I moved the client and server to new packages. Everything compiles, but at runtime when I run the client I get an error: UNIMPLEMENTED Method not found.

I checked that the method is in fact implemented. When I start the Springboot app where do I confirm that the bean itself was loaded? I just see confirmation that the application is up and running but no list of loaded beans in log.

Here is my Springboot application. All I did was move the client and server bean into a new package called example.client and example.server. before they were in same package as spring boot com.test.MyApplication

io.grpc.StatusRuntimeException: UNIMPLEMENTED: Method not found:  example.GreetingService/greetingWithResponseStream
at io.grpc.Status.asRuntimeException(Status.java:526)
at  io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:434)
at  io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39)

package com.test;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class MyApplication {
public static void main(String[] args) {
        SpringApplication.run(MyApplication.class, args);
}
}

GreetingService.proto:

syntax = "proto3";
package example;
message HelloRequest {
    string name = 1;
}

message HelloResponse {
    string greeting = 1;
}

service GreetingService {
    rpc greeting (HelloRequest) returns (HelloResponse);
    rpc greetingWithResponseStream (HelloRequest) returns (stream  HelloResponse);
  rpc greetingWithRequestStream (stream HelloRequest) returns  (HelloResponse);
rpc greetingWithRequestResponseStream (stream HelloRequest) returns  (stream HelloResponse);

}

import example.GreetingServiceOuterClass;
import io.grpc.stub.StreamObserver;
import java.util.ArrayList;
import java.util.List;
@GrpcService
public class GreetingServiceImpl extends    GreetingServiceGrpc.GreetingServiceImplBase{
@Override
public void greeting(GreetingServiceOuterClass.HelloRequest request,   StreamObserver<GreetingServiceOuterClass.HelloResponse> responseObserver) {
    GreetingServiceOuterClass.HelloResponse response =    GreetingServiceOuterClass.HelloResponse.newBuilder()
            .setGreeting("HELLO, THERE, " + request.getName())
            .build();
    responseObserver.onNext(response);
    responseObserver.onCompleted();
}
@Override
public void  greetingWithResponseStream(GreetingServiceOuterClass.HelloRequest request, StreamObserver<GreetingServiceOuterClass.HelloResponse> responseObserver) {
    GreetingServiceOuterClass.HelloResponse response =  GreetingServiceOuterClass.HelloResponse.newBuilder()
            .setGreeting("(Stream Response) Hello there, " + request.getName())
            .build();
    responseObserver.onNext(response);
    responseObserver.onNext(response);
    responseObserver.onNext(response);
    responseObserver.onCompleted();
}
@Override
public StreamObserver<GreetingServiceOuterClass.HelloRequest>  greetingWithRequestStream(StreamObserver<GreetingServiceOuterClass.HelloResponse> responseObserver) {
    return new StreamObserver<GreetingServiceOuterClass.HelloRequest>() {
        private List<String> nameList = new ArrayList<>();
        @Override
        public void onNext(GreetingServiceOuterClass.HelloRequest request) {
            nameList.add(request.getName());
        }
        @Override
        public void onError(Throwable t) {
            t.printStackTrace();
        }
        @Override
        public void onCompleted() {
            GreetingServiceOuterClass.HelloResponse response = GreetingServiceOuterClass.HelloResponse.newBuilder()
                    .setGreeting("(Stream Request) Hello there, " + String.join(" ", nameList))
                    .build();
            responseObserver.onNext(response);
            responseObserver.onCompleted();
        }
    };
}
@Override
public StreamObserver<GreetingServiceOuterClass.HelloRequest> greetingWithRequestResponseStream(StreamObserver<GreetingServiceOuterClass.HelloResponse> responseObserver) {
    return new StreamObserver<GreetingServiceOuterClass.HelloRequest>() {
        private List<String> nameList = new ArrayList<>();
        @Override
        public void onNext(GreetingServiceOuterClass.HelloRequest request) {
            nameList.add(request.getName());
        }
        @Override
        public void onError(Throwable t) {
            t.printStackTrace();
        }
        @Override
        public void onCompleted() {
            nameList.stream()
                    .map(name ->  GreetingServiceOuterClass.HelloResponse.newBuilder().setGreeting("(Stream Request/Response) Hello there, " + name).build())
                    .forEach(responseObserver::onNext);
            responseObserver.onCompleted();
        }
    };
}
}

package example.client;
import example.GreetingServiceGrpc;
import example.GreetingServiceOuterClass;
import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
import io.grpc.stub.StreamObserver;
import java.util.stream.Stream;
public class Client {
public static void main(String[] args) {
    ManagedChannel channel =   ManagedChannelBuilder.forTarget("localhost:8081")
            .usePlaintext()
            .build();
        GreetingServiceGrpc.GreetingServiceBlockingStub stub =    GreetingServiceGrpc.newBlockingStub(channel);
    GreetingServiceOuterClass.HelloRequest request = GreetingServiceOuterClass.HelloRequest.newBuilder().setName("Steve").build();
    GreetingServiceOuterClass.HelloResponse response = stub.greeting(request);
    System.out.println(response);
}

public static class RequestStreamClient {

    public static void main(String[] args) throws InterruptedException  {
        new Thread(() -> {
            ManagedChannel channel = ManagedChannelBuilder.forTarget("localhost:8081")
                    .usePlaintext()
                    .build();
            GreetingServiceGrpc.GreetingServiceStub stub = GreetingServiceGrpc.newStub(channel);
            StreamObserver<GreetingServiceOuterClass.HelloRequest> requestStream =
                    stub.greetingWithRequestStream(new StreamObserver<GreetingServiceOuterClass.HelloResponse>() {
                        @Override
                        public void onNext(GreetingServiceOuterClass.HelloResponse response) {
                            System.out.println(response);
                        }
                        @Override
                        public void onError(Throwable t) {
                            t.printStackTrace();
                        }
                        @Override
                        public void onCompleted() {
                        }
                    });
            Stream.of("Steve1", "Steve2", "Steve3")
                    .map(name -> GreetingServiceOuterClass.HelloRequest.newBuilder().setName(name).build())
                    .forEach(requestStream::onNext);
            requestStream.onCompleted();

        }).start();
        Thread.sleep(10000);

    }
  }
}
READ ALSO
Can&#39;t find a way to color the Mandelbrot-set the way i&#39;m aiming for

Can't find a way to color the Mandelbrot-set the way i'm aiming for

I've been successful in coloring the Mandelbrot-set although I can't zoom in very far until it becomes "blurry" and the pattern stopsI fix this by increasing the max_iteration, this works but I get very few colors at *1 magnification and lot's of colors...

48
How can I get Spring&#39;s WebFlux to emit a response

How can I get Spring's WebFlux to emit a response

When I create a Spring-webflux webclient I'm not able to get it to go into the subscribe or doOnNext callbackI keep getting this error: java

33
How to prevent a jfxbutton from listening to keyboard

How to prevent a jfxbutton from listening to keyboard

I'm creating a login stage and setting a maximum number of attempts to login, so i don't want the login button to be activated without the user clicking it or pressing the enter keyThe problem is that if shift or any other key is touched the button triggers,...

55
How do i create a jar that can be used to encrypt columns in GRAILS and Springboot?

How do i create a jar that can be used to encrypt columns in GRAILS and Springboot?

We have several applications running in grails and other frameworks such as springbootWe need to create a custom jar that can be used to encrypt/decrypt columns in a database

71