无法加载库“netty_transport_native_kqueue_x86_64”,尝试其他加载机制

Dan*_*lus 4 java netty

我正在尝试在带有 Mac OS Sierra 的 Macbook 中使用带有本机 Kqueue 套接字的 netty。我遵循了 netty 本地传输指南

我仍然在日志中看到此错误:

       52 [main] DEBUG io.netty.util.internal.NativeLibraryLoader  - Unable to load the library 'netty_transport_native_kqueue_x86_64', trying other loading mechanism.
    java.lang.UnsatisfiedLinkError: no netty_transport_native_kqueue_x86_64 in java.library.path
    	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
    	at java.lang.Runtime.loadLibrary0(Runtime.java:870)
    	at java.lang.System.loadLibrary(System.java:1122)
    	at io.netty.util.internal.NativeLibraryUtil.loadLibrary(NativeLibraryUtil.java:38)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
Run Code Online (Sandbox Code Playgroud)

进而:

55 [main] DEBUG io.netty.util.internal.NativeLibraryLoader  - netty_transport_native_kqueue_x86_64 cannot be loaded from java.libary.path, now trying export to -Dio.netty.native.workdir: /var/folders/95/w43w134s6lg14g8584qpwcmh0000gn/T
java.lang.UnsatisfiedLinkError: no netty_transport_native_kqueue_x86_64 in java.library.path
	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
	at java.lang.Runtime.loadLibrary0(Runtime.java:870)
	at java.lang.System.loadLibrary(System.java:1122)
	at io.netty.util.internal.NativeLibraryUtil.loadLibrary(NativeLibraryUtil.java:38)
	at io.netty.util.internal.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:243)
	at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:124)
Run Code Online (Sandbox Code Playgroud)

我正在使用 maven,这是我的 pom:

<dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-transport-native-kqueue</artifactId>
            <version>4.1.19.Final</version>
            <classifier>${os.detected.name}-${os.detected.arch}</classifier>
        </dependency>
        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-all</artifactId>
            <version>4.1.9.Final</version>
        </dependency>
....

  <build>
        <extensions>
            <extension>
                <groupId>kr.motd.maven</groupId>
                <artifactId>os-maven-plugin</artifactId>
                <version>1.5.0.Final</version>
            </extension>
        </extensions>
Run Code Online (Sandbox Code Playgroud)

这是 Intellij 列出的导入库: libnetty_transport_native_kqueue_x86_64.jnilib

Nor*_*rer 8

请注意,这些只是调试消息,因为它尝试了不同的加载策略。您可以KQueue.isAvailable()在初始化完成后通过使用来检查它是否能够加载本机代码。