bigtable错误(jetty alpn和openssl都不可用)

vx6bjr1n  于 2021-06-10  发布在  Hbase
关注(0)|答案(1)|浏览(451)

我想用akkahttp构建一个restfulapi,它能够从bigtable(hbase)检索数据。
bigtable客户端api需要 netty-tcnative-boringssl-static 连接。这在intellij ide中运行得很好,但是当我使用sbt assembly构建一个胖jar,然后运行服务器时,会出现以下错误:

2017-01-10 12:03:41 ERROR BigtableSession:129 - Neither Jetty ALPN nor OpenSSL are available. OpenSSL unavailability cause:
java.lang.IllegalArgumentException: Failed to load any of the given libraries: [netty-tcnative-linux-x86_64, netty-tcnative-linux-x86_64-fedora, netty-tcnative]
Exception in thread "main" java.lang.ExceptionInInitializerError
        at mycompany.algo.serving.model.algoServingModelLoaderTest$.loadLastModel(algoServingModelLoaderTest.scala:36)
        at mycompany.algo.serving.algoServingLauncherTest$$anonfun$4.apply(algoServingLauncherTest.scala:38)
        at mycompany.algo.serving.algoServingLauncherTest$$anonfun$4.apply(algoServingLauncherTest.scala:38)
        at mycompany.serving.MultiPredictorEbapServing$$anonfun$loadPredictors$1.apply(MultiPredictorEbapServing.scala:25)
        at mycompany.serving.MultiPredictorEbapServing$$anonfun$loadPredictors$1.apply(MultiPredictorEbapServing.scala:25)
        at scala.collection.immutable.List.foreach(List.scala:381)
        at mycompany.serving.MultiPredictorEbapServing.loadPredictors(MultiPredictorEbapServing.scala:25)
        at mycompany.algo.serving.algoServingLauncherTest$.delayedEndpoint$mycompany$algo$serving$algoServingLauncherTest$1(algoServingLauncherTest.scala:38)
        at mycompany.algo.serving.algoServingLauncherTest$delayedInit$body.apply(algoServingLauncherTest.scala:11)
        at scala.Function0$class.apply$mcV$sp(Function0.scala:34)
        at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
        at scala.App$$anonfun$main$1.apply(App.scala:76)
        at scala.App$$anonfun$main$1.apply(App.scala:76)
        at scala.collection.immutable.List.foreach(List.scala:381)
        at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:35)
        at scala.App$class.main(App.scala:76)
        at mycompany.algo.serving.algoServingLauncherTest$.main(algoServingLauncherTest.scala:11)
        at mycompany.algo.serving.algoServingLauncherTest.main(algoServingLauncherTest.scala)
Caused by: java.lang.IllegalgotateException: Could not find an appropriate constructor for com.google.cloud.bigtable.hbase1_2.BigtableConnection
        at com.google.cloud.bigtable.hbase.BigtableConfiguration.connect(BigtableConfiguration.java:88)
        at com.google.cloud.bigtable.hbase.BigtableConfiguration.connect(BigtableConfiguration.java:72)
        at mycompany.algo.serving.model.algoServingModel$.<init>(algoServingModel.scala:25)
        at mycompany.algo.serving.model.algoServingModel$.<clinit>(algoServingModel.scala)
        ... 18 more
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
        at com.google.cloud.bigtable.hbase.BigtableConfiguration.connect(BigtableConfiguration.java:85)
        ... 21 more
Caused by: java.lang.IllegalgotateException: Neither Jetty ALPN nor OpenSSL via netty-tcnative were properly configured.
        at com.google.cloud.bigtable.grpc.BigtableSession.<init>(BigtableSession.java:279)
        at org.apache.hadoop.hbase.client.AbstractBigtableConnection.<init>(AbstractBigtableConnection.java:137)
        at org.apache.hadoop.hbase.client.AbstractBigtableConnection.<init>(AbstractBigtableConnection.java:104)
        at com.google.cloud.bigtable.hbase1_2.BigtableConnection.<init>(BigtableConnection.java:50)
        ... 26 more

我该怎么办?
我使用的是scala 2.11.8,我的sbt看起来像:

dependencies ++= Seq(
  "com.google.cloud" % "google-cloud" % "0.7.0",
  "com.google.cloud.bigtable" % "bigtable-hbase-1.2" % "0.9.4",
  "io.netty" % "netty-tcnative-boringssl-static" % "1.1.33.Fork19",
  "org.apache.hbase" % "hbase-server" % "1.2.1",
  "org.apache.hbase" % "hbase-client" % "1.2.1",
  "org.apache.hbase" % "hbase-common" % "1.2.1",
)

谢谢你的帮助
编辑编辑,因为我原来虽然它是由阿克卡引起的,但可以重新没有阿克卡它
编辑我的坏,本机库被驱逐与我的sbt汇编合并策略
编辑这个与maven一起工作,问题似乎与sbt有关
此解决方案是由sbt程序集默认合并策略引起的。我需要添加以下设置

val settings = Seq(
    assemblyMergeStrategy in assembly := {
      case PathList("META-INF", xs @ _*) =>
        xs map {_.toLowerCase} match {
          case "native" :: xs =>
            MergeStrategy.singleOrError
          case _ => MergeStrategy.discard
        }
      case "reference.conf" => MergeStrategy.concat
      case x => MergeStrategy.first
    }
)
fnx2tebb

fnx2tebb1#

问题是sbt合并策略,我用这个策略来解决问题。

assemblyMergeStrategy in assembly := {
  case PathList("META-INF", "MANIFEST.MF") => MergeStrategy.discard
  case _ => MergeStrategy.first
}

相关问题