【问题标题】:gRPC + SSL + uber jar + Linux = Failed to load netty-tcnativegRPC + SSL + uber jar + Linux = 无法加载 netty-tcnative
【发布时间】:2016-05-23 16:00:30
【问题描述】:

感谢@nmittler 在gRPC + SSL = UnsatisfiedLinkError 上的 gRPC + SSL 在我的 Windows PC 和目标 Linux 平台上工作。

但仅当我为 io.netty/netty-tcnative-boringssl-static/1.1.33.Fork17 依赖项指定 <classifier> 时。可以是:

  1. 硬编码(例如到windows-x86_64
  2. 使用os-maven-plugin${os.detected.classifier} 注入

但这意味着我只能在:

  1. Windows(或我硬编码的任何平台)
  2. 我用来编译的平台

但我真正希望能够在 Windows 上编译但在 Linux 上运行。所以,理论上,我可以不使用 <classifier> 来引入 uber-jar(在 the docs 中指定)。

但这不起作用:当我单步执行 io.netty.util.internal.NativeLibraryLoader.load() 时,我找到了对 System.mapLibraryName() 的调用。

  • 在 Windows 上,这会正确返回 netty-tcnative.dll
  • 但在 Linux (RHEL 7) 上,它返回 libnetty-tcnative.so ... 不在 uber-jar 中(jar tf netty-tcnative-boringssl-static-1.1.33.Fork17.jar 返回,除其他外,META-INF/native/libnetty-tcnative-linux-x86_64.so)。

查看 jar 的 分类 linux 版本,我可以看到它包含 META-INF/native/libnetty-tcnative.so ... 这意味着需要以不同方式构建 uber jar(将 libnetty-tcnative-linux-x86_64.so 重命名为 @987654337 @) 或NativeLibraryLoader 某处需要考虑不同的命名...

我在正确的轨道上吗?有人可以帮忙解决这个问题吗?

【问题讨论】:

    标签: linux ssl grpc


    【解决方案1】:

    你是对的,Maven Central 上的 uber jar 不包含共享库。目前尚不清楚问题是构建还是部署 jar。我已经提出https://github.com/netty/netty-tcnative/issues/145 来跟踪修复。

    【讨论】:

    • 谢谢。我已将我的 2 便士价值添加到该问题中。
    • 离线讨论。 Maven 上的 uber jar 很好。似乎问题在于您使用的是不支持 uber jar 的旧版本的 Netty (4.1.0-CR3)。 Uber jar 支持是在 4.1.0-CR4 中引入的,升级似乎已经解决了您的问题。
    【解决方案2】:

    升级到io.grpc/grpc-all/0.14.0(从0.13.2)解决了我的问题,因为它带来了更新版本的io.netty/netty-handler4.1.0.CR74.1.0.CR3)。

    【讨论】:

      猜你喜欢
      • 2015-02-09
      • 1970-01-01
      • 1970-01-01
      • 2020-05-23
      • 1970-01-01
      • 2021-10-23
      • 2018-07-24
      • 2017-08-19
      • 1970-01-01
      相关资源
      最近更新 更多