我试图在Mac OS Sierra的Macbook中使用带有原生Kqueue套接字的netty。 我关注了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>
&#13;
这是intellij列为导入的libs: libnetty_transport_native_kqueue_x86_64.jnilib
答案 0 :(得分:0)
注意这些只是调试消息,因为它尝试不同的加载策略。您可以在初始化完成后使用KQueue.isAvailable()
检查是否能够加载本机代码。