尝试在tomcat下使用netty-tcnative-boringssl-static。当从JUnit测试中调用代码时,它可以正常工作,但在tomcat容器中却不是这样。io.netty.handler.ssl.OpenSsl类中的此代码正在尝试从SSL类的类加载器加载本机库。
private static void loadTcNative() throws Exception {
String os = normalizeOs(SystemPropertyUtil.get("os.name", ""));
String arch = normalizeArch(SystemPropertyUtil.get("os.arch", ""));
Set<String> libNames = new LinkedHashSet<String>(3);
// First, try loading the platform-specific library. Platform-specific
// libraries will be available if using a tcnative uber jar.
libNames.add("netty-tcnative-" + os + '-' + arch);
if (LINUX.equalsIgnoreCase(os)) {
// Fedora SSL lib so naming (libssl.so.10 vs libssl.so.1.0.0)..
libNames.add("netty-tcnative-" + os + '-' + arch + "-fedora");
}
// finally the default library.
libNames.add("netty-tcnative");
NativeLibraryLoader.loadFirstAvailable(SSL.class.getClassLoader(),
libNames.toArray(new String[libNames.size()]));
}当它单独工作时(例如,从JUnit测试中),它会在netty-tcnative-boringssl-static jar中找到SSL类,并从那些jar依赖项中的WEB-INF/native中获取本机库。但是当它在tomcat下工作时,它会从tomcat库中获取SSL类,并且找不到本地库。
尝试使用tomcat 8和9
发布于 2017-02-01 00:50:11
这将很快被修复,并成为4.1.9的一部分。最终:
发布于 2017-01-28 22:29:56
似乎在这个帖子https://github.com/netty/netty-tcnative/issues/136中找到了解决方案
我刚刚复制了netty-tcnative-boringssl-static.jar,并将tomcat-jni.jar重新链接到tomcat库目录中
https://stackoverflow.com/questions/41909764
复制相似问题