gRPC + SSL +超级jar + Linux =无法加载netty-tcnative [英] gRPC + SSL + uber jar + Linux = Failed to load netty-tcnative
问题描述
感谢@nmittler在 gRPC + SSL = UnsatisfiedLinkError 上,我正在使用gRPC + SSL我的Windows PC和目标Linux平台上.
Thanks to @nmittler on gRPC + SSL = UnsatisfiedLinkError I've got gRPC + SSL working on my Windows PC and on the target Linux platform.
但是仅当我为 io.netty/netty-tcnative-boringssl-static/1.1.33.Fork17
依赖项指定< classifier>
时.可以是:
But only when I specify a <classifier>
for the io.netty/netty-tcnative-boringssl-static/1.1.33.Fork17
dependency. That can be:
- 硬编码(例如到
windows-x86_64
) - 使用 os-maven-plugin 和
$ {os注入.detection.classifier}
但这意味着我只能在以下位置运行:
But that means I can only run on:
- Windows(或我使用硬编码的任何平台)
- 我以前编译的平台
但是我真正想做的是在Windows上编译但在Linux上运行.因此,从理论上讲,,我可以省去< classifier>
来放入uber-jar(如
But what I'd really like to be able to do is compile on Windows but run on Linux. So, in theory, I can just leave off the <classifier>
to bring in the uber-jar (as specified in the docs).
但这是行不通的:当我逐步执行 io.netty.util.internal.NativeLibraryLoader.load()
时,我发现了对 System.mapLibraryName()
的调用>.
But this doesn't work: when I step through io.netty.util.internal.NativeLibraryLoader.load()
I find a call to 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
).
- On Windows this correctly returns
netty-tcnative.dll
. - But on Linux (RHEL 7) it returns
libnetty-tcnative.so
... which isn't in the uber-jar (jar tf netty-tcnative-boringssl-static-1.1.33.Fork17.jar
returns, among others,META-INF/native/libnetty-tcnative-linux-x86_64.so
).
查看jar的 classified linux版本,我可以看到它包含 META-INF/native/libnetty-tcnative.so
...,这暗示着uberjar需要以不同的方式构建(将 libnetty-tcnative-linux-x86_64.so
重命名为 libnetty-tcnative.so
)或 NativeLibraryLoader
考虑到不同的命名方式...
Looking at the classified linux version of the jar I can see it contains META-INF/native/libnetty-tcnative.so
... which implies either the uber jar needs to be built differently (to rename libnetty-tcnative-linux-x86_64.so
to libnetty-tcnative.so
) or NativeLibraryLoader
somewhere needs to take account of the different naming...
我在正确的轨道上吗?有人可以帮忙解决此问题吗?
Am I on the right track? Can someone help fix this?
推荐答案
升级到 io.grpc/grpc-all/0.14.0
(来自 0.13.2
)解决了我的问题,因为它带来了 io.netty/netty-handler
的较新版本( 4.1.0.CR7
与 4.1.0.CR3 代码>).
Upgrading to io.grpc/grpc-all/0.14.0
(from 0.13.2
) cured my problem because it brings in a newer version of io.netty/netty-handler
(4.1.0.CR7
vs. 4.1.0.CR3
).
这篇关于gRPC + SSL +超级jar + Linux =无法加载netty-tcnative的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!