1

My packages are as following:

    implementation("io.netty:netty-transport-native-epoll:$nettyVersion")
    implementation("io.netty:netty-transport-native-kqueue:$nettyVersion")
    implementation("io.netty:netty-transport-native-epoll:$nettyVersion:linux-aarch_64")
    implementation("io.netty:netty-transport-native-epoll:$nettyVersion:linux-x86_64")
    implementation("io.netty:netty-transport-native-kqueue:$nettyVersion:osx-x86_64")

Gradle showing the package getting installed correctly: (where <source> is the path to our internal library storage)

Cached resource <source>/releases/io/netty/netty-transport-native-kqueue/4.1.78.Final/netty-transport-native-kqueue-4.1.78.Final-osx-x86_64.jar is up-to-date (lastModified: Fri Jun 24 17:45:28 PDT 2022).

Gradle output showing the system:

------------------------------------------------------------------------
Detecting the operating system and CPU architecture
------------------------------------------------------------------------
os.detected.name=osx
os.detected.arch=x86_64
os.detected.version=12.4
os.detected.version.major=12
os.detected.version.minor=4
os.detected.classifier=osx-x86_64

Simplest way I can reproduce is:

KQueue.isAvailable()

returns false.

If I run the following to get more information:

KQueue.unavailabilityCause().printStackTrace();

I get: (removed repeating or unnecessary stack traces)

java.lang.UnsatisfiedLinkError: could not load a native library: netty_transport_native_kqueue_x86_64
        at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:239)
        at io.netty.channel.kqueue.Native.loadNativeLibrary(Native.java:155)
        ...
        Suppressed: java.lang.UnsatisfiedLinkError: no netty_transport_native_kqueue_x86_64 in java.library.path: /Users/kdilsiz/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
        ...

Am I not supposed to be able to run this code? What am I missing?

If I search online for the error, it shows outdated Netty package loading errors (only showing up in debug level logging). This is NOT my problem. The package loads correctly when I run gradle and I can see it is being cached/loaded with gradle -info --refresh-dependencies.

Sunderam Dubey
  • 1
  • 11
  • 20
  • 40
Kemal Tezer Dilsiz
  • 3,739
  • 5
  • 24
  • 43
  • 2
    I've reopened the question; honestly, I don't understand why people voted to close it as "about general computing hardware and software". For future reference, you have enough reputation that you can vote to reopen the question, which will bring it in front of reviewers to correct the issue. – Ryan M Jul 04 '22 at 09:46
  • I know I have enough reputation, but I do not think I should make the effort to fight people to keep my question up. I'll post the solution in a bit. – Kemal Tezer Dilsiz Jul 05 '22 at 20:58

1 Answers1

0

It was due to one of the dependencies importing netty-all. This was causing the Kqueue packages to be imported twice and with different versions.

The problem was that I did not fully read the stack trace from:

KQueue.unavailabilityCause().printStackTrace();

In the end of that stack trace, it said:

Caused by: java.lang.IllegalStateException: Multiple resources found for 'META-INF/native/libnetty_transport_native_kqueue_x86_64.jnilib' with different content:
...

After that, I was able to find where the package was coming from and fix it. Then I was able to locally run the Java Code to run domain socket and test it locally.

I used IntelliJ to run it after the fix. (VsCode had a problem even after the fix, hence wanted to mention it)

Kemal Tezer Dilsiz
  • 3,739
  • 5
  • 24
  • 43