无法加载库 'netty_transport_native_kqueue_x86_64',正在尝试其他加载机制

Unable to load the library 'netty_transport_native_kqueue_x86_64', trying other loading mechanism

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

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

       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)

然后:

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)

我正在使用 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>

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

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