0

i start whith gRPC bulding an easy Java Chat Programm.

protc --version prints libprotoc 3.5.1

the -proto File:

syntax = "proto3";
option java_multiple_files = true;
option java_package = "grpc";
// whihout this Option i get no service
option java_generic_services = true;
option java_outer_classname = "ChatProto";
option objc_class_prefix = "HLW";
package chat;
message ClientPost {
  string name = 1;
  string value = 2;
}
message ServerReply {
  ClientPost back = 1;
}
// The  service definition.
service  Verbindung {
  rpc ChatService (stream ClientPost) returns (stream ServerReply);
}

// file end

  1. why i need to set the option java_generic_services ?

    class ChatImpl extends grpc.Verbindung { @Override public void chatService(RpcController controller, ClientPost request, RpcCallback done) { // why i get this kind of Service ? } }

// 2. why i get an other class name ? shut be VerbindungImplBase

expected Function

public void sayHello(HelloRequest req, StreamObserver<HelloReply> responseObserver) { }
  1. what must i do to get this kind of expected Service Function ?

may be an wrong protoc compiler / wrong Installation / missing Parts ?

susanne
  • 21
  • 2

2 Answers2

0

You're likely not running the gRPC code generator. Without the full configuration of how you're running protoc I can't point out too much detail, but you are likely only generating the protobuf messages via java_generic_services=true.

You shouldn't need java_generic_services=true. Instead, you should generate the messages like you are now, but then also use the grpc-java plugin. There's documentation for when running protoc manually and our main documentation documents the preferred method, using Maven or Gradle plugins.

Eric Anderson
  • 24,057
  • 5
  • 55
  • 76
  • Ok i see; the protoc Compiler needs an plugin. at this point i have not found an compiled Version of this Plugin (runnung open Suse leap 42.2) – susanne May 25 '18 at 04:13
  • Pre-built binaries for grpc-java's plugin are available on Maven Central: http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22io.grpc%22%20a%3A%22protoc-gen-grpc-java%22 – Eric Anderson May 31 '18 at 01:08
  • the pre-build cange nothing :-( i got the same output – susanne Jun 03 '18 at 14:55
  • the pre-buld plugin change nothing - i get the same output try to compile the plugin ,fail :java.lang.UnsupportedClassVersionError: net/ltgt/gradle/errorprone/ErrorPronePlugin : Unsupported major.minor version 52.0 – susanne Jun 03 '18 at 14:58
0

I have an open suse leap 42.2 System this Version knows nothing about grpc - no Support from this side

i get the compiled protoc - it comes whithout the needed Java-gen Plugin

found https://github.com/grpc/grpc-java/blob/master/compiler/README.md

"Normally you don't need to compile the codegen by yourself, since pre-compiled binaries for common platforms are available on Maven Central."

i found only some exe files. - not useful

"Change to the compiler directory:"

i have no compiler dir. - still try to find out were i can get

NetBeans have only an Editor plugin for protofiles - so my IDE can't handel gRPC

maybe for other IDEs are the Maven Plugins for gRPC are helpful

i expected an full protoc Compiler with all needed plugins :-) not an install the tool adventure.

a the Moment for me: gRPC - nice Idea , but i get an "install the gRPC" Adventure

susanne
  • 21
  • 2