Closed NomadBlacky closed 4 years ago
Thanks. Fixed in #1322
Thank you for fixing the issue!
BTW, I tried the gRPC example in README, but the gRPC client thrown a NoSuchMethodError
.
I noticed that it was working with JDK8 on my environment, so I switched to JDK11 and It worked fine.
Does Airframe support JDK11 or later?
JVM
$ java -version
openjdk version "1.8.0_252"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_252-b09)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.252-b09, mixed mode)
Server
$ ./target/pack/bin/greeter-main grpcServer
2020-10-21 04:42:53.294+0900 info [LifeCycleManager] [session:65bb9029] Starting a new lifecycle ... - (LifeCycleManager.scala:284)
2020-10-21 04:42:53.307+0900 info [LifeCycleManager] [session:65bb9029] ======== STARTED ======== - (LifeCycleManager.scala:288)
2020-10-21 04:42:53.462+0900 info [GrpcServer] Starting gRPC server default at localhost:8080 - (GrpcServer.scala:107)
2020-10-21 04:43:06.309+0900 info [DISupport] Received a request from: RPC0 - (GreeterApi.scala:9)
Client
$ ./target/pack/bin/greeter-main grpcClient
Exception in thread "main" io.grpc.StatusRuntimeException: CANCELLED: Failed to read message.
at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:262)
at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:243)
at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:156)
at greeter.api.ServiceGrpc$SyncClient$GreeterApi$.hello(ServiceGrpc.scala:71)
at greeter.GreeterMain.$anonfun$grpcClient$1(GreeterMain.scala:93)
at scala.collection.immutable.Range.foreach$mVc$sp(Range.scala:158)
at greeter.GreeterMain.grpcClient(GreeterMain.scala:92)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at wvlet.airframe.surface.reflect.ReflectMethodSurface.call(ReflectMethodSurface.scala:47)
at wvlet.airframe.launcher.CommandLauncher.$anonfun$execute$8(Launcher.scala:372)
at scala.Option.map(Option.scala:230)
at wvlet.airframe.launcher.CommandLauncher.execute(Launcher.scala:370)
at wvlet.airframe.launcher.CommandLauncher.execute(Launcher.scala:336)
at wvlet.airframe.launcher.Launcher.execute(Launcher.scala:160)
at greeter.GreeterMain$.main(GreeterMain.scala:29)
at greeter.GreeterMain.main(GreeterMain.scala)
Caused by: java.lang.NoSuchMethodError: java.io.InputStream.readAllBytes()[B
at wvlet.airframe.http.grpc.GrpcServiceBuilder$RPCResponseMarshaller.parse(GrpcServiceBuilder.scala:140)
at io.grpc.MethodDescriptor.parseResponse(MethodDescriptor.java:273)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1MessagesAvailable.runInternal(ClientCallImpl.java:655)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1MessagesAvailable.runInContext(ClientCallImpl.java:640)
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:740)
at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:149)
... 16 more
@NomadBlacky Thanks. Filed a bug ticket in #1329 We usually use JDK11, and are trying to stop the support for JDK8 and Scala 2.11 soon, but this error can be solved by using another method.
I tried the example project of examples/rpc-examples/hello-rpc/, but I met a compilation error.
source code
logs