![](/img/trans.png)
[英]Could not find TLS ALPN provider; no working netty-tcnative, Conscrypt, or Jetty NPN/ALPN available
[英]Error while using google texttospeech : Could not find TLS ALPN provider; no working netty-tcnative, Conscrypt, or Jetty NPN/ALPN available
使用 GGoogle Text to Speech API 時出現以下異常,
java.lang.IllegalStateException: Could not find TLS ALPN provider; no working netty-tcnative, Conscrypt, or Jetty NPN/ALPN available
at i.g.n.s.io.grpc.netty.GrpcSslContexts.defaultSslProvider(GrpcSslContexts.java:233)
at i.g.n.s.io.grpc.netty.GrpcSslContexts.configure(GrpcSslContexts.java:144)
at i.g.n.s.io.grpc.netty.GrpcSslContexts.forClient(GrpcSslContexts.java:93)
at i.g.n.s.i.grpc.netty.NettyChannelBuilder.buildTransportFactory(NettyChannelBuilder.java:397)
at i.g.i.AbstractManagedChannelImplBuilder.build(AbstractManagedChannelImplBuilder.java:513)
at c.g.a.g.g.InstantiatingGrpcChannelProvider.createSingleChannel(InstantiatingGrpcChannelProvider.java:304)
at c.g.a.g.g.InstantiatingGrpcChannelProvider.access$1500(InstantiatingGrpcChannelProvider.java:71)
at c.g.a.g.g.InstantiatingGrpcChannelProvider$1.createSingleChannel(InstantiatingGrpcChannelProvider.java:202)
at com.google.api.gax.grpc.ChannelPool.create(ChannelPool.java:72)
at c.g.a.g.g.InstantiatingGrpcChannelProvider.createChannel(InstantiatingGrpcChannelProvider.java:209)
at c.g.a.g.g.InstantiatingGrpcChannelProvider.getTransportChannel(InstantiatingGrpcChannelProvider.java:192)
at com.google.api.gax.rpc.ClientContext.create(ClientContext.java:155)
at c.g.c.t.v1.stub.GrpcTextToSpeechStub.create(GrpcTextToSpeechStub.java:74)
at c.g.c.t.v1.stub.TextToSpeechStubSettings.createStub(TextToSpeechStubSettings.java:100)
at c.g.c.texttospeech.v1.TextToSpeechClient.<init>(TextToSpeechClient.java:128)
at c.g.c.texttospeech.v1.TextToSpeechClient.create(TextToSpeechClient.java:109)
at c.g.c.texttospeech.v1.TextToSpeechClient.create(TextToSpeechClient.java:101)
at com.vxml.util.GoogleTTSUtil.getSpeech(GoogleTTSUtil.scala:11)
at com.vxml.util.GoogleTTSUtil.getSpeech$(GoogleTTSUtil.scala:10)
at com.VxmlActivitiesMain$.getSpeech(VxmlActivitiesMain.scala:22)
at com.vxml.rest.TTSRoute.$anonfun$ttsRoute$2(TTSRoute.scala:35)
at akka.http.scaladsl.server.Directive$.$anonfun$addByNameNullaryApply$2(...
使用了以下 sbt 依賴項,
val googleTTS = "com.google.cloud" % "google-cloud-texttospeech" % "1.0.2"
val googleLibraries = "com.google.cloud" % "libraries-bom" % "4.4.1"
val googleGrpc = "com.google.api" % "gax-grpc" % "1.56.0"
val nettyShaded = "io.grpc" % "grpc-netty-shaded" % "1.28.1"
val nettyTcnativeBoringSsl = "io.netty" % "netty-tcnative-boringssl-static" % "2.0.20.Final"
Docker 使用的基礎鏡像:openjdk:8u212-jdk-alpine
這個鏈接https://github.com/grpc/grpc-java/blob/master/SECURITY.md.netty說:
io.grpc:grpc-netty-shaded 包含 Netty 和 netty-tcnative-boringssl-static 的正確版本,不會與其他 Netty 用法沖突。
您可以嘗試刪除自己的nettyTcnativeBoringSsl
依賴項,看看是否能解決問題?
在 IllegalStateException 之前, gRPC 將轉儲帶有附加信息的日志消息。 因此,最好的辦法是查看這些消息並確定更多正在發生的事情。
但是,由於您在 Alpine 上運行,我預計問題是Error loading shared library libcrypt.so.1: No such file or directory
。 gRPC在其安全文檔中提到,Alpine 默認情況下與 glibc 缺乏一些兼容性,可以通過安裝 package: apk update && apk add libc6-compat
來恢復兼容性。 這個問題是由 Linux 上通常使用的 glibc 和 Alpine 上使用的 musl 之間的差異引起的。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.