Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

play-scala-grpc-example run exception #154

Open
borice opened this issue Jan 25, 2022 · 5 comments
Open

play-scala-grpc-example run exception #154

borice opened this issue Jan 25, 2022 · 5 comments

Comments

@borice
Copy link

borice commented Jan 25, 2022

Cloned the play-samples on my machine, and followed the documentation for locally running the play-scala-grpc-example sample app, but received an exception when invoking curl --insecure https://localhost:9443/

Here's the exception on the server:

! @7mf0gi45h - Internal server error, for (GET) [https://localhost:9443/] ->

play.api.UnexpectedException: Unexpected exception[StatusRuntimeException: UNAVAILABLE: io exception
Channel Pipeline: [SslHandler#0, ProtocolNegotiators$ClientTlsHandler#0, WriteBufferingAndExceptionHandler#0, DefaultChannelPipeline$TailContext#0]]
	at play.api.http.HttpErrorHandlerExceptions$.throwableToUsefulException(HttpErrorHandler.scala:358)
	at play.api.http.DefaultHttpErrorHandler.onServerError(HttpErrorHandler.scala:264)
	at play.core.server.AkkaHttpServer$$anonfun$2.applyOrElse(AkkaHttpServer.scala:430)
	at play.core.server.AkkaHttpServer$$anonfun$2.applyOrElse(AkkaHttpServer.scala:422)
	at scala.concurrent.Future.$anonfun$recoverWith$1(Future.scala:417)
	at scala.concurrent.impl.Promise.$anonfun$transformWith$1(Promise.scala:41)
	at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64)
	at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:63)
	at akka.dispatch.BatchingExecutor$BlockableBatch.$anonfun$run$1(BatchingExecutor.scala:100)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
Caused by: io.grpc.StatusRuntimeException: UNAVAILABLE: io exception
Channel Pipeline: [SslHandler#0, ProtocolNegotiators$ClientTlsHandler#0, WriteBufferingAndExceptionHandler#0, DefaultChannelPipeline$TailContext#0]
	at io.grpc.Status.asRuntimeException(Status.java:533)
	at akka.grpc.internal.UnaryCallAdapter.onClose(UnaryCallAdapter.scala:40)
	at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:413)
	at io.grpc.internal.ClientCallImpl.access$500(ClientCallImpl.java:66)
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:742)
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:721)
	at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
	at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
Caused by: javax.net.ssl.SSLHandshakeException: General OpenSslEngine problem
	at io.grpc.netty.shaded.io.netty.handler.ssl.ReferenceCountedOpenSslEngine.handshakeException(ReferenceCountedOpenSslEngine.java:1771)
	at io.grpc.netty.shaded.io.netty.handler.ssl.ReferenceCountedOpenSslEngine.wrap(ReferenceCountedOpenSslEngine.java:776)
	at javax.net.ssl.SSLEngine.wrap(SSLEngine.java:511)
	at io.grpc.netty.shaded.io.netty.handler.ssl.SslHandler.wrap(SslHandler.java:1079)
	at io.grpc.netty.shaded.io.netty.handler.ssl.SslHandler.wrapNonAppData(SslHandler.java:970)
	at io.grpc.netty.shaded.io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1443)
	at io.grpc.netty.shaded.io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1275)
	at io.grpc.netty.shaded.io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1322)
	at io.grpc.netty.shaded.io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:501)
	at io.grpc.netty.shaded.io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:440)
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
	at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:456)
	at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:323)
	at sun.security.validator.Validator.validate(Validator.java:271)
	at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:315)
	at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:278)
	at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:141)
	at io.grpc.netty.shaded.io.netty.handler.ssl.OpenSslTlsv13X509ExtendedTrustManager.checkServerTrusted(OpenSslTlsv13X509ExtendedTrustManager.java:223)
	at io.grpc.netty.shaded.io.netty.handler.ssl.ReferenceCountedOpenSslClientContext$ExtendedTrustManagerVerifyCallback.verify(ReferenceCountedOpenSslClientContext.java:261)
	at io.grpc.netty.shaded.io.netty.handler.ssl.ReferenceCountedOpenSslContext$AbstractCertificateVerifier.verify(ReferenceCountedOpenSslContext.java:700)
	at io.grpc.netty.shaded.io.netty.internal.tcnative.SSL.readFromSSL(Native Method)
	Suppressed: javax.net.ssl.SSLHandshakeException: error:1000007d:SSL routines:OPENSSL_internal:CERTIFICATE_VERIFY_FAILED
		at io.grpc.netty.shaded.io.netty.handler.ssl.ReferenceCountedOpenSslEngine.sslReadErrorResult(ReferenceCountedOpenSslEngine.java:1287)
		at io.grpc.netty.shaded.io.netty.handler.ssl.ReferenceCountedOpenSslEngine.unwrap(ReferenceCountedOpenSslEngine.java:1248)
		at io.grpc.netty.shaded.io.netty.handler.ssl.ReferenceCountedOpenSslEngine.unwrap(ReferenceCountedOpenSslEngine.java:1324)
		at io.grpc.netty.shaded.io.netty.handler.ssl.SslHandler$SslEngineType$1.unwrap(SslHandler.java:201)
		at io.grpc.netty.shaded.io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1380)
		at io.grpc.netty.shaded.io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1275)
		at io.grpc.netty.shaded.io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1322)
		at io.grpc.netty.shaded.io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:501)
		at io.grpc.netty.shaded.io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:440)
		at io.grpc.netty.shaded.io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276)
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
	at sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:141)
	at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:126)
	at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:280)
	at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:451)
	at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:323)
	at sun.security.validator.Validator.validate(Validator.java:271)
	at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:315)
	at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:278)
	at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:141)
	at io.grpc.netty.shaded.io.netty.handler.ssl.OpenSslTlsv13X509ExtendedTrustManager.checkServerTrusted(OpenSslTlsv13X509ExtendedTrustManager.java:223)

Using following java version on OSX 11.6.2:

openjdk version "1.8.0_312"
OpenJDK Runtime Environment (build 1.8.0_312-bre_2021_10_20_23_15-b00)
OpenJDK 64-Bit Server VM (build 25.312-b00, mixed mode)
@mkurz
Copy link
Member

mkurz commented Jan 30, 2022

Does it work with Java 11?

@borice
Copy link
Author

borice commented Jan 30, 2022

Not for me. Same exception.

$ sbt clean runProd                                                                 
[info] welcome to sbt 1.3.13 (Homebrew Java 11.0.12)
[info] loading settings for project global-plugins from plugins.sbt ...
[info] loading global plugins from /Users/capitanu/.sbt/1.0/plugins
[info] loading settings for project play-scala-grpc-example-build-build from buildinfo.sbt ...
[info] loading project definition from /Users/capitanu/Projects/Personal/Scala/Play/play-samples/play-scala-grpc-example/project/project
[info] loading settings for project play-scala-grpc-example-build from paradox.sbt,plugins.sbt ...
[info] loading project definition from /Users/capitanu/Projects/Personal/Scala/Play/play-samples/play-scala-grpc-example/project
[info] loading settings for project play-scala-grpc-example from build.sbt ...
[info] loading settings for project docs from build.sbt ...
[info]   __              __
[info]   \ \     ____   / /____ _ __  __
[info]    \ \   / __ \ / // __ `// / / /
[info]    / /  / /_/ // // /_/ // /_/ /
[info]   /_/  / .___//_/ \__,_/ \__, /
[info]       /_/               /____/
[info]
[info] Version 2.8.13 running Java 11.0.12
[info]
[info] Play is run entirely by the community. If you want to keep using it please consider donating:
[info] https://www.playframework.com/sponsors
[info]
[success] Total time: 0 s, completed Jan 30, 2022, 4:33:42 PM
[info] Wrote /Users/capitanu/Projects/Personal/Scala/Play/play-samples/play-scala-grpc-example/target/scala-2.12/play-scala-grpc-example_2.12-1.0-SNAPSHOT.pom
[warn] There may be incompatibilities among your library dependencies; run 'evicted' to see detailed eviction warnings.
[info] Compiling 1 protobuf files to /Users/capitanu/Projects/Personal/Scala/Play/play-samples/play-scala-grpc-example/target/scala-2.12/akka-grpc/main
[info] Compiling schema /Users/capitanu/Projects/Personal/Scala/Play/play-samples/play-scala-grpc-example/app/protobuf/helloworld.proto
protoc-jar: protoc version: 3.11.4, detected platform: osx-x86_64 (mac os x/x86_64)
protoc-jar: embedded: bin/3.11.4/protoc-3.11.4-osx-x86_64.exe
protoc-jar: executing: [/var/folders/r5/z3nmn9z10kz22ccrztydswk80000gn/T/protocjar2374479514212904201/bin/protoc.exe, --plugin=protoc-gen-jvm_0=/var/folders/r5/z3nmn9z10kz22ccrztydswk80000gn/T/protocbridge5946874575416728784, --plugin=protoc-gen-jvm_1=/var/folders/r5/z3nmn9z10kz22ccrztydswk80000gn/T/protocbridge15179089231811965558, --plugin=protoc-gen-jvm_2=/var/folders/r5/z3nmn9z10kz22ccrztydswk80000gn/T/protocbridge14106307900279389958, --plugin=protoc-gen-jvm_3=/var/folders/r5/z3nmn9z10kz22ccrztydswk80000gn/T/protocbridge3291260986314496511, --plugin=protoc-gen-play-grpc-client-scala_4=/var/folders/r5/z3nmn9z10kz22ccrztydswk80000gn/T/protocbridge13445907278678428938, --plugin=protoc-gen-play-grpc-server-scala_5=/var/folders/r5/z3nmn9z10kz22ccrztydswk80000gn/T/protocbridge11292358243235635222, --jvm_0_out=/Users/capitanu/Projects/Personal/Scala/Play/play-samples/play-scala-grpc-example/target/scala-2.12/akka-grpc/main, --jvm_0_opt=flat_package, --jvm_1_out=/Users/capitanu/Projects/Personal/Scala/Play/play-samples/play-scala-grpc-example/target/scala-2.12/akka-grpc/main, --jvm_1_opt=flat_package, --jvm_2_out=/Users/capitanu/Projects/Personal/Scala/Play/play-samples/play-scala-grpc-example/target/scala-2.12/akka-grpc/main, --jvm_2_opt=flat_package, --jvm_3_out=/Users/capitanu/Projects/Personal/Scala/Play/play-samples/play-scala-grpc-example/target/scala-2.12/akka-grpc/main, --jvm_3_opt=flat_package, --play-grpc-client-scala_4_out=/Users/capitanu/Projects/Personal/Scala/Play/play-samples/play-scala-grpc-example/target/scala-2.12/akka-grpc/main, --play-grpc-client-scala_4_opt=flat_package, --play-grpc-server-scala_5_out=/Users/capitanu/Projects/Personal/Scala/Play/play-samples/play-scala-grpc-example/target/scala-2.12/akka-grpc/main, --play-grpc-server-scala_5_opt=flat_package, -I/Users/capitanu/Projects/Personal/Scala/Play/play-samples/play-scala-grpc-example/app/protobuf, -I/Users/capitanu/Projects/Personal/Scala/Play/play-samples/play-scala-grpc-example/target/protobuf_external_src, -I/Users/capitanu/Projects/Personal/Scala/Play/play-samples/play-scala-grpc-example/app/proto, -I/Users/capitanu/Projects/Personal/Scala/Play/play-samples/play-scala-grpc-example/target/protobuf_external, /Users/capitanu/Projects/Personal/Scala/Play/play-samples/play-scala-grpc-example/app/protobuf/helloworld.proto]
/Users/capitanu/Projects/Personal/Scala/Play/play-samples/play-scala-grpc-example/app/proto: warning: directory does not exist.
[info] Generating Akka gRPC service interface for example.myapp.helloworld.grpc.GreeterService
[info] Generating Akka gRPC client for example.myapp.helloworld.grpc.GreeterService
[info] Generating Akka gRPC service handler for example.myapp.helloworld.grpc.GreeterService
[info] Generating Play gRPC play client provider for example.myapp.helloworld.grpc.GreeterService
[info] Generated [example.myapp.helloworld.grpc.AkkaGrpcClientModule] add it to play.modules.enabled and a section with Akka gRPC client config under akka.grpc.client."servicepackage.ServiceName" to be able to inject client instances.
[info] Generating Play gRPC service play router for example.myapp.helloworld.grpc.GreeterService
[info] Main Scala API documentation to /Users/capitanu/Projects/Personal/Scala/Play/play-samples/play-scala-grpc-example/target/scala-2.12/api...
[info] Compiling 16 Scala sources and 1 Java source to /Users/capitanu/Projects/Personal/Scala/Play/play-samples/play-scala-grpc-example/target/scala-2.12/classes ...
[info] Non-compiled module 'compiler-bridge_2.12' for Scala 2.12.13. Compiling...
[info]   Compilation completed in 7.878s.
model contains 37 documentable templates
[info] Main Scala API documentation successful.

(Starting server. Type Ctrl+D to exit logs, the server will remain in background)

[jetty-alpn-agent][ warn] Could not find a matching alpn-boot jar for Java version: 11.0.12
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/Users/capitanu/Projects/Personal/Scala/Play/play-samples/play-scala-grpc-example/target/universal/stage/lib/com.google.inject.guice-4.2.3.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[info] a.e.s.Slf4jLogger - Slf4jLogger started
[info] play.api.Play - Application started (Prod) (no global state)
[info] p.c.s.AkkaHttpServer - Enabling HTTP/2 on Akka HTTP server...
[info] p.c.s.AkkaHttpServer - Listening for HTTP on /127.0.0.1:9000
[info] p.c.s.AkkaHttpServer - Listening for HTTPS on /127.0.0.1:9443
[error] p.a.h.DefaultHttpErrorHandler -

! @7mgcgd9mh - Internal server error, for (GET) [https://localhost:9443/] ->

play.api.UnexpectedException: Unexpected exception[StatusRuntimeException: UNAVAILABLE: io exception
Channel Pipeline: [SslHandler#0, ProtocolNegotiators$ClientTlsHandler#0, WriteBufferingAndExceptionHandler#0, DefaultChannelPipeline$TailContext#0]]
	at play.api.http.HttpErrorHandlerExceptions$.throwableToUsefulException(HttpErrorHandler.scala:358)
	at play.api.http.DefaultHttpErrorHandler.onServerError(HttpErrorHandler.scala:264)
	at play.core.server.AkkaHttpServer$$anonfun$2.applyOrElse(AkkaHttpServer.scala:430)
	at play.core.server.AkkaHttpServer$$anonfun$2.applyOrElse(AkkaHttpServer.scala:422)
	at scala.concurrent.Future.$anonfun$recoverWith$1(Future.scala:417)
	at scala.concurrent.impl.Promise.$anonfun$transformWith$1(Promise.scala:41)
	at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64)
	at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:63)
	at akka.dispatch.BatchingExecutor$BlockableBatch.$anonfun$run$1(BatchingExecutor.scala:100)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
Caused by: io.grpc.StatusRuntimeException: UNAVAILABLE: io exception
Channel Pipeline: [SslHandler#0, ProtocolNegotiators$ClientTlsHandler#0, WriteBufferingAndExceptionHandler#0, DefaultChannelPipeline$TailContext#0]
	at io.grpc.Status.asRuntimeException(Status.java:533)
	at akka.grpc.internal.UnaryCallAdapter.onClose(UnaryCallAdapter.scala:40)
	at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:413)
	at io.grpc.internal.ClientCallImpl.access$500(ClientCallImpl.java:66)
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:742)
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:721)
	at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
	at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
Caused by: javax.net.ssl.SSLHandshakeException: General OpenSslEngine problem
	at io.grpc.netty.shaded.io.netty.handler.ssl.ReferenceCountedOpenSslEngine.handshakeException(ReferenceCountedOpenSslEngine.java:1771)
	at io.grpc.netty.shaded.io.netty.handler.ssl.ReferenceCountedOpenSslEngine.wrap(ReferenceCountedOpenSslEngine.java:776)
	at java.base/javax.net.ssl.SSLEngine.wrap(SSLEngine.java:522)
	at io.grpc.netty.shaded.io.netty.handler.ssl.SslHandler.wrap(SslHandler.java:1079)
	at io.grpc.netty.shaded.io.netty.handler.ssl.SslHandler.wrapNonAppData(SslHandler.java:970)
	at io.grpc.netty.shaded.io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1443)
	at io.grpc.netty.shaded.io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1275)
	at io.grpc.netty.shaded.io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1322)
	at io.grpc.netty.shaded.io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:501)
	at io.grpc.netty.shaded.io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:440)
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
	at java.base/sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:439)
	at java.base/sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:306)
	at java.base/sun.security.validator.Validator.validate(Validator.java:264)
	at java.base/sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:313)
	at java.base/sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:276)
	at java.base/sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:141)
	at io.grpc.netty.shaded.io.netty.handler.ssl.ReferenceCountedOpenSslClientContext$ExtendedTrustManagerVerifyCallback.verify(ReferenceCountedOpenSslClientContext.java:261)
	at io.grpc.netty.shaded.io.netty.handler.ssl.ReferenceCountedOpenSslContext$AbstractCertificateVerifier.verify(ReferenceCountedOpenSslContext.java:700)
	at io.grpc.netty.shaded.io.netty.internal.tcnative.SSL.readFromSSL(Native Method)
	at io.grpc.netty.shaded.io.netty.handler.ssl.ReferenceCountedOpenSslEngine.readPlaintextData(ReferenceCountedOpenSslEngine.java:595)
	Suppressed: javax.net.ssl.SSLHandshakeException: error:1000007d:SSL routines:OPENSSL_internal:CERTIFICATE_VERIFY_FAILED
		at io.grpc.netty.shaded.io.netty.handler.ssl.ReferenceCountedOpenSslEngine.sslReadErrorResult(ReferenceCountedOpenSslEngine.java:1287)
		at io.grpc.netty.shaded.io.netty.handler.ssl.ReferenceCountedOpenSslEngine.unwrap(ReferenceCountedOpenSslEngine.java:1248)
		at io.grpc.netty.shaded.io.netty.handler.ssl.ReferenceCountedOpenSslEngine.unwrap(ReferenceCountedOpenSslEngine.java:1324)
		at io.grpc.netty.shaded.io.netty.handler.ssl.SslHandler$SslEngineType$1.unwrap(SslHandler.java:201)
		at io.grpc.netty.shaded.io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1380)
		at io.grpc.netty.shaded.io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1275)
		at io.grpc.netty.shaded.io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1322)
		at io.grpc.netty.shaded.io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:501)
		at io.grpc.netty.shaded.io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:440)
		at io.grpc.netty.shaded.io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276)
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
	at java.base/sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:141)
	at java.base/sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:126)
	at java.base/java.security.cert.CertPathBuilder.build(CertPathBuilder.java:297)
	at java.base/sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:434)
	at java.base/sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:306)
	at java.base/sun.security.validator.Validator.validate(Validator.java:264)
	at java.base/sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:313)
	at java.base/sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:276)
	at java.base/sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:141)
	at io.grpc.netty.shaded.io.netty.handler.ssl.ReferenceCountedOpenSslClientContext$ExtendedTrustManagerVerifyCallback.verify(ReferenceCountedOpenSslClientContext.java:261)

Once the server started (successfully) with sbt runProd, I issued the curl command from before at which point the exception above was thrown and logged on the server.

openjdk version "11.0.12" 2021-07-20
OpenJDK Runtime Environment Homebrew (build 11.0.12+0)
OpenJDK 64-Bit Server VM Homebrew (build 11.0.12+0, mixed mode)

@twick00
Copy link

twick00 commented Mar 18, 2022

+1

@etwei-linkedin
Copy link

etwei-linkedin commented Dec 8, 2022

+1 seeing the same. Tried playing around with adding cacerts jvm run args, couldn't get it worked.

@etwei-linkedin
Copy link

Not for me. Same exception.

$ sbt clean runProd                                                                 
[info] welcome to sbt 1.3.13 (Homebrew Java 11.0.12)
[info] loading settings for project global-plugins from plugins.sbt ...
[info] loading global plugins from /Users/capitanu/.sbt/1.0/plugins
[info] loading settings for project play-scala-grpc-example-build-build from buildinfo.sbt ...
[info] loading project definition from /Users/capitanu/Projects/Personal/Scala/Play/play-samples/play-scala-grpc-example/project/project
[info] loading settings for project play-scala-grpc-example-build from paradox.sbt,plugins.sbt ...
[info] loading project definition from /Users/capitanu/Projects/Personal/Scala/Play/play-samples/play-scala-grpc-example/project
[info] loading settings for project play-scala-grpc-example from build.sbt ...
[info] loading settings for project docs from build.sbt ...
[info]   __              __
[info]   \ \     ____   / /____ _ __  __
[info]    \ \   / __ \ / // __ `// / / /
[info]    / /  / /_/ // // /_/ // /_/ /
[info]   /_/  / .___//_/ \__,_/ \__, /
[info]       /_/               /____/
[info]
[info] Version 2.8.13 running Java 11.0.12
[info]
[info] Play is run entirely by the community. If you want to keep using it please consider donating:
[info] https://www.playframework.com/sponsors
[info]
[success] Total time: 0 s, completed Jan 30, 2022, 4:33:42 PM
[info] Wrote /Users/capitanu/Projects/Personal/Scala/Play/play-samples/play-scala-grpc-example/target/scala-2.12/play-scala-grpc-example_2.12-1.0-SNAPSHOT.pom
[warn] There may be incompatibilities among your library dependencies; run 'evicted' to see detailed eviction warnings.
[info] Compiling 1 protobuf files to /Users/capitanu/Projects/Personal/Scala/Play/play-samples/play-scala-grpc-example/target/scala-2.12/akka-grpc/main
[info] Compiling schema /Users/capitanu/Projects/Personal/Scala/Play/play-samples/play-scala-grpc-example/app/protobuf/helloworld.proto
protoc-jar: protoc version: 3.11.4, detected platform: osx-x86_64 (mac os x/x86_64)
protoc-jar: embedded: bin/3.11.4/protoc-3.11.4-osx-x86_64.exe
protoc-jar: executing: [/var/folders/r5/z3nmn9z10kz22ccrztydswk80000gn/T/protocjar2374479514212904201/bin/protoc.exe, --plugin=protoc-gen-jvm_0=/var/folders/r5/z3nmn9z10kz22ccrztydswk80000gn/T/protocbridge5946874575416728784, --plugin=protoc-gen-jvm_1=/var/folders/r5/z3nmn9z10kz22ccrztydswk80000gn/T/protocbridge15179089231811965558, --plugin=protoc-gen-jvm_2=/var/folders/r5/z3nmn9z10kz22ccrztydswk80000gn/T/protocbridge14106307900279389958, --plugin=protoc-gen-jvm_3=/var/folders/r5/z3nmn9z10kz22ccrztydswk80000gn/T/protocbridge3291260986314496511, --plugin=protoc-gen-play-grpc-client-scala_4=/var/folders/r5/z3nmn9z10kz22ccrztydswk80000gn/T/protocbridge13445907278678428938, --plugin=protoc-gen-play-grpc-server-scala_5=/var/folders/r5/z3nmn9z10kz22ccrztydswk80000gn/T/protocbridge11292358243235635222, --jvm_0_out=/Users/capitanu/Projects/Personal/Scala/Play/play-samples/play-scala-grpc-example/target/scala-2.12/akka-grpc/main, --jvm_0_opt=flat_package, --jvm_1_out=/Users/capitanu/Projects/Personal/Scala/Play/play-samples/play-scala-grpc-example/target/scala-2.12/akka-grpc/main, --jvm_1_opt=flat_package, --jvm_2_out=/Users/capitanu/Projects/Personal/Scala/Play/play-samples/play-scala-grpc-example/target/scala-2.12/akka-grpc/main, --jvm_2_opt=flat_package, --jvm_3_out=/Users/capitanu/Projects/Personal/Scala/Play/play-samples/play-scala-grpc-example/target/scala-2.12/akka-grpc/main, --jvm_3_opt=flat_package, --play-grpc-client-scala_4_out=/Users/capitanu/Projects/Personal/Scala/Play/play-samples/play-scala-grpc-example/target/scala-2.12/akka-grpc/main, --play-grpc-client-scala_4_opt=flat_package, --play-grpc-server-scala_5_out=/Users/capitanu/Projects/Personal/Scala/Play/play-samples/play-scala-grpc-example/target/scala-2.12/akka-grpc/main, --play-grpc-server-scala_5_opt=flat_package, -I/Users/capitanu/Projects/Personal/Scala/Play/play-samples/play-scala-grpc-example/app/protobuf, -I/Users/capitanu/Projects/Personal/Scala/Play/play-samples/play-scala-grpc-example/target/protobuf_external_src, -I/Users/capitanu/Projects/Personal/Scala/Play/play-samples/play-scala-grpc-example/app/proto, -I/Users/capitanu/Projects/Personal/Scala/Play/play-samples/play-scala-grpc-example/target/protobuf_external, /Users/capitanu/Projects/Personal/Scala/Play/play-samples/play-scala-grpc-example/app/protobuf/helloworld.proto]
/Users/capitanu/Projects/Personal/Scala/Play/play-samples/play-scala-grpc-example/app/proto: warning: directory does not exist.
[info] Generating Akka gRPC service interface for example.myapp.helloworld.grpc.GreeterService
[info] Generating Akka gRPC client for example.myapp.helloworld.grpc.GreeterService
[info] Generating Akka gRPC service handler for example.myapp.helloworld.grpc.GreeterService
[info] Generating Play gRPC play client provider for example.myapp.helloworld.grpc.GreeterService
[info] Generated [example.myapp.helloworld.grpc.AkkaGrpcClientModule] add it to play.modules.enabled and a section with Akka gRPC client config under akka.grpc.client."servicepackage.ServiceName" to be able to inject client instances.
[info] Generating Play gRPC service play router for example.myapp.helloworld.grpc.GreeterService
[info] Main Scala API documentation to /Users/capitanu/Projects/Personal/Scala/Play/play-samples/play-scala-grpc-example/target/scala-2.12/api...
[info] Compiling 16 Scala sources and 1 Java source to /Users/capitanu/Projects/Personal/Scala/Play/play-samples/play-scala-grpc-example/target/scala-2.12/classes ...
[info] Non-compiled module 'compiler-bridge_2.12' for Scala 2.12.13. Compiling...
[info]   Compilation completed in 7.878s.
model contains 37 documentable templates
[info] Main Scala API documentation successful.

(Starting server. Type Ctrl+D to exit logs, the server will remain in background)

[jetty-alpn-agent][ warn] Could not find a matching alpn-boot jar for Java version: 11.0.12
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/Users/capitanu/Projects/Personal/Scala/Play/play-samples/play-scala-grpc-example/target/universal/stage/lib/com.google.inject.guice-4.2.3.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[info] a.e.s.Slf4jLogger - Slf4jLogger started
[info] play.api.Play - Application started (Prod) (no global state)
[info] p.c.s.AkkaHttpServer - Enabling HTTP/2 on Akka HTTP server...
[info] p.c.s.AkkaHttpServer - Listening for HTTP on /127.0.0.1:9000
[info] p.c.s.AkkaHttpServer - Listening for HTTPS on /127.0.0.1:9443
[error] p.a.h.DefaultHttpErrorHandler -

! @7mgcgd9mh - Internal server error, for (GET) [https://localhost:9443/] ->

play.api.UnexpectedException: Unexpected exception[StatusRuntimeException: UNAVAILABLE: io exception
Channel Pipeline: [SslHandler#0, ProtocolNegotiators$ClientTlsHandler#0, WriteBufferingAndExceptionHandler#0, DefaultChannelPipeline$TailContext#0]]
	at play.api.http.HttpErrorHandlerExceptions$.throwableToUsefulException(HttpErrorHandler.scala:358)
	at play.api.http.DefaultHttpErrorHandler.onServerError(HttpErrorHandler.scala:264)
	at play.core.server.AkkaHttpServer$$anonfun$2.applyOrElse(AkkaHttpServer.scala:430)
	at play.core.server.AkkaHttpServer$$anonfun$2.applyOrElse(AkkaHttpServer.scala:422)
	at scala.concurrent.Future.$anonfun$recoverWith$1(Future.scala:417)
	at scala.concurrent.impl.Promise.$anonfun$transformWith$1(Promise.scala:41)
	at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64)
	at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:63)
	at akka.dispatch.BatchingExecutor$BlockableBatch.$anonfun$run$1(BatchingExecutor.scala:100)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
Caused by: io.grpc.StatusRuntimeException: UNAVAILABLE: io exception
Channel Pipeline: [SslHandler#0, ProtocolNegotiators$ClientTlsHandler#0, WriteBufferingAndExceptionHandler#0, DefaultChannelPipeline$TailContext#0]
	at io.grpc.Status.asRuntimeException(Status.java:533)
	at akka.grpc.internal.UnaryCallAdapter.onClose(UnaryCallAdapter.scala:40)
	at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:413)
	at io.grpc.internal.ClientCallImpl.access$500(ClientCallImpl.java:66)
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:742)
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:721)
	at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
	at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
Caused by: javax.net.ssl.SSLHandshakeException: General OpenSslEngine problem
	at io.grpc.netty.shaded.io.netty.handler.ssl.ReferenceCountedOpenSslEngine.handshakeException(ReferenceCountedOpenSslEngine.java:1771)
	at io.grpc.netty.shaded.io.netty.handler.ssl.ReferenceCountedOpenSslEngine.wrap(ReferenceCountedOpenSslEngine.java:776)
	at java.base/javax.net.ssl.SSLEngine.wrap(SSLEngine.java:522)
	at io.grpc.netty.shaded.io.netty.handler.ssl.SslHandler.wrap(SslHandler.java:1079)
	at io.grpc.netty.shaded.io.netty.handler.ssl.SslHandler.wrapNonAppData(SslHandler.java:970)
	at io.grpc.netty.shaded.io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1443)
	at io.grpc.netty.shaded.io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1275)
	at io.grpc.netty.shaded.io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1322)
	at io.grpc.netty.shaded.io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:501)
	at io.grpc.netty.shaded.io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:440)
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
	at java.base/sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:439)
	at java.base/sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:306)
	at java.base/sun.security.validator.Validator.validate(Validator.java:264)
	at java.base/sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:313)
	at java.base/sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:276)
	at java.base/sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:141)
	at io.grpc.netty.shaded.io.netty.handler.ssl.ReferenceCountedOpenSslClientContext$ExtendedTrustManagerVerifyCallback.verify(ReferenceCountedOpenSslClientContext.java:261)
	at io.grpc.netty.shaded.io.netty.handler.ssl.ReferenceCountedOpenSslContext$AbstractCertificateVerifier.verify(ReferenceCountedOpenSslContext.java:700)
	at io.grpc.netty.shaded.io.netty.internal.tcnative.SSL.readFromSSL(Native Method)
	at io.grpc.netty.shaded.io.netty.handler.ssl.ReferenceCountedOpenSslEngine.readPlaintextData(ReferenceCountedOpenSslEngine.java:595)
	Suppressed: javax.net.ssl.SSLHandshakeException: error:1000007d:SSL routines:OPENSSL_internal:CERTIFICATE_VERIFY_FAILED
		at io.grpc.netty.shaded.io.netty.handler.ssl.ReferenceCountedOpenSslEngine.sslReadErrorResult(ReferenceCountedOpenSslEngine.java:1287)
		at io.grpc.netty.shaded.io.netty.handler.ssl.ReferenceCountedOpenSslEngine.unwrap(ReferenceCountedOpenSslEngine.java:1248)
		at io.grpc.netty.shaded.io.netty.handler.ssl.ReferenceCountedOpenSslEngine.unwrap(ReferenceCountedOpenSslEngine.java:1324)
		at io.grpc.netty.shaded.io.netty.handler.ssl.SslHandler$SslEngineType$1.unwrap(SslHandler.java:201)
		at io.grpc.netty.shaded.io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1380)
		at io.grpc.netty.shaded.io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1275)
		at io.grpc.netty.shaded.io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1322)
		at io.grpc.netty.shaded.io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:501)
		at io.grpc.netty.shaded.io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:440)
		at io.grpc.netty.shaded.io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276)
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
	at java.base/sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:141)
	at java.base/sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:126)
	at java.base/java.security.cert.CertPathBuilder.build(CertPathBuilder.java:297)
	at java.base/sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:434)
	at java.base/sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:306)
	at java.base/sun.security.validator.Validator.validate(Validator.java:264)
	at java.base/sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:313)
	at java.base/sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:276)
	at java.base/sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:141)
	at io.grpc.netty.shaded.io.netty.handler.ssl.ReferenceCountedOpenSslClientContext$ExtendedTrustManagerVerifyCallback.verify(ReferenceCountedOpenSslClientContext.java:261)

Once the server started (successfully) with sbt runProd, I issued the curl command from before at which point the exception above was thrown and logged on the server.

openjdk version "11.0.12" 2021-07-20
OpenJDK Runtime Environment Homebrew (build 11.0.12+0)
OpenJDK 64-Bit Server VM Homebrew (build 11.0.12+0, mixed mode)

Hey @borice, since it's been a while, wanted to check in to see if you happen to solve the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants