简体   繁体   中英

Error while using google texttospeech : Could not find TLS ALPN provider; no working netty-tcnative, Conscrypt, or Jetty NPN/ALPN available

Getting the following exception while using 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(...

Used the following sbt dependencies,

  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 Base Image used: openjdk:8u212-jdk-alpine

This linkhttps://github.com/grpc/grpc-java/blob/master/SECURITY.md.netty says:

io.grpc:grpc-netty-shaded includes the proper version of Netty and netty-tcnative-boringssl-static in a way that won't conflict with other Netty usages.

Can you try removing your own nettyTcnativeBoringSsl dependency and see if that solves the problem?

Before the IllegalStateException, gRPC will dump log messages with additional info . So the best thing to do would be to look at those messages and determine more of what is happening.

However, since you are running on Alpine, I expect the problem is Error loading shared library libcrypt.so.1: No such file or directory . gRPCmentions in its security documentation that Alpine lacks some compatibility with glibc by default, and compatibility can be restored by installing a package: apk update && apk add libc6-compat . This problem is caused by the differences between glibc that is generally used on Linux and musl as used on Alpine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM