首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >io.netty.handler.ssl.OpenSsl使用tomcat类而不是self

io.netty.handler.ssl.OpenSsl使用tomcat类而不是self
EN

Stack Overflow用户
提问于 2017-01-28 20:26:07
回答 2查看 711关注 0票数 0

尝试在tomcat下使用netty-tcnative-boringssl-static。当从JUnit测试中调用代码时,它可以正常工作,但在tomcat容器中却不是这样。io.netty.handler.ssl.OpenSsl类中的此代码正在尝试从SSL类的类加载器加载本机库。

代码语言:javascript
复制
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

EN

回答 2

Stack Overflow用户

发布于 2017-02-01 00:50:11

这将很快被修复,并成为4.1.9的一部分。最终:

https://github.com/netty/netty/pull/5766

票数 1
EN

Stack Overflow用户

发布于 2017-01-28 22:29:56

似乎在这个帖子https://github.com/netty/netty-tcnative/issues/136中找到了解决方案

我刚刚复制了netty-tcnative-boringssl-static.jar,并将tomcat-jni.jar重新链接到tomcat库目录中

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41909764

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档