Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ktor no netty_transport_native_epoll_x86_64 in java.library.path

During starting Ktor application, I've got the following logs:

java.lang.UnsatisfiedLinkError: no netty_transport_native_epoll_x86_64 in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1871)
    at java.lang.Runtime.loadLibrary0(Runtime.java:872)
    at java.lang.System.loadLibrary(System.java:1124)
    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)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at io.netty.util.internal.NativeLibraryLoader$1.run(NativeLibraryLoader.java:369)
    at java.security.AccessController.doPrivileged(Native Method)
    at io.netty.util.internal.NativeLibraryLoader.loadLibraryByHelper(NativeLibraryLoader.java:361)
    at io.netty.util.internal.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:339)
    at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:136)
    at io.netty.channel.epoll.Native.loadNativeLibrary(Native.java:231)
    at io.netty.channel.epoll.Native.<clinit>(Native.java:58)
    at io.netty.channel.epoll.Epoll.<clinit>(Epoll.java:39)
    at io.ktor.server.netty.EventLoopGroupProxy$Companion.create(NettyApplicationEngine.kt:189)
    at io.ktor.server.netty.NettyApplicationEngine.<init>(NettyApplicationEngine.kt:74)
    at io.ktor.server.netty.EngineMain.main(EngineMain.kt:22)
22:56:07.760 [main] DEBUG io.netty.util.internal.NativeLibraryLoader - netty_transport_native_epoll_x86_64 cannot be loaded from java.library.path, now trying export to -Dio.netty.native.workdir: /tmp
java.lang.UnsatisfiedLinkError: no netty_transport_native_epoll_x86_64 in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1871)
    at java.lang.Runtime.loadLibrary0(Runtime.java:872)
    at java.lang.System.loadLibrary(System.java:1124)
    at io.netty.util.internal.NativeLibraryUtil.loadLibrary(NativeLibraryUtil.java:38)
    at io.netty.util.internal.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:349)
    at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:136)
    at io.netty.channel.epoll.Native.loadNativeLibrary(Native.java:231)
    at io.netty.channel.epoll.Native.<clinit>(Native.java:58)
    at io.netty.channel.epoll.Epoll.<clinit>(Epoll.java:39)
    at io.ktor.server.netty.EventLoopGroupProxy$Companion.create(NettyApplicationEngine.kt:189)
    at io.ktor.server.netty.NettyApplicationEngine.<init>(NettyApplicationEngine.kt:74)
    at io.ktor.server.netty.EngineMain.main(EngineMain.kt:22)
    Suppressed: java.lang.UnsatisfiedLinkError: no netty_transport_native_epoll_x86_64 in java.library.path
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1871)
        at java.lang.Runtime.loadLibrary0(Runtime.java:872)
        at java.lang.System.loadLibrary(System.java:1124)
        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)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at io.netty.util.internal.NativeLibraryLoader$1.run(NativeLibraryLoader.java:369)
        at java.security.AccessController.doPrivileged(Native Method)
        at io.netty.util.internal.NativeLibraryLoader.loadLibraryByHelper(NativeLibraryLoader.java:361)
        at io.netty.util.internal.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:339)
        ... 7 common frames omitted
22:56:07.761 [main] DEBUG io.netty.util.internal.NativeLibraryLoader - Unable to load the library 'netty_transport_native_epoll', trying other loading mechanism.
java.lang.UnsatisfiedLinkError: no netty_transport_native_epoll in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1871)
    at java.lang.Runtime.loadLibrary0(Runtime.java:872)
    at java.lang.System.loadLibrary(System.java:1124)
    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)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at io.netty.util.internal.NativeLibraryLoader$1.run(NativeLibraryLoader.java:369)
    at java.security.AccessController.doPrivileged(Native Method)
    at io.netty.util.internal.NativeLibraryLoader.loadLibraryByHelper(NativeLibraryLoader.java:361)
    at io.netty.util.internal.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:339)
    at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:136)
    at io.netty.channel.epoll.Native.loadNativeLibrary(Native.java:234)
    at io.netty.channel.epoll.Native.<clinit>(Native.java:58)
    at io.netty.channel.epoll.Epoll.<clinit>(Epoll.java:39)
    at io.ktor.server.netty.EventLoopGroupProxy$Companion.create(NettyApplicationEngine.kt:189)
    at io.ktor.server.netty.NettyApplicationEngine.<init>(NettyApplicationEngine.kt:74)
    at io.ktor.server.netty.EngineMain.main(EngineMain.kt:22)
22:56:07.761 [main] DEBUG io.netty.util.internal.NativeLibraryLoader - netty_transport_native_epoll cannot be loaded from java.library.path, now trying export to -Dio.netty.native.workdir: /tmp
java.lang.UnsatisfiedLinkError: no netty_transport_native_epoll in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1871)
    at java.lang.Runtime.loadLibrary0(Runtime.java:872)
    at java.lang.System.loadLibrary(System.java:1124)
    at io.netty.util.internal.NativeLibraryUtil.loadLibrary(NativeLibraryUtil.java:38)
    at io.netty.util.internal.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:349)
    at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:136)
    at io.netty.channel.epoll.Native.loadNativeLibrary(Native.java:234)
    at io.netty.channel.epoll.Native.<clinit>(Native.java:58)
    at io.netty.channel.epoll.Epoll.<clinit>(Epoll.java:39)
    at io.ktor.server.netty.EventLoopGroupProxy$Companion.create(NettyApplicationEngine.kt:189)
    at io.ktor.server.netty.NettyApplicationEngine.<init>(NettyApplicationEngine.kt:74)
    at io.ktor.server.netty.EngineMain.main(EngineMain.kt:22)
    Suppressed: java.lang.UnsatisfiedLinkError: no netty_transport_native_epoll in java.library.path
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1871)
        at java.lang.Runtime.loadLibrary0(Runtime.java:872)
        at java.lang.System.loadLibrary(System.java:1124)
        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)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at io.netty.util.internal.NativeLibraryLoader$1.run(NativeLibraryLoader.java:369)
        at java.security.AccessController.doPrivileged(Native Method)
        at io.netty.util.internal.NativeLibraryLoader.loadLibraryByHelper(NativeLibraryLoader.java:361)
        at io.netty.util.internal.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:339)
        ... 7 common frames omitted

the build file

plugins {
    application
    kotlin("jvm") version "1.3.61"
}

group = "io.oceanstack"
version = "1.0-SNAPSHOT"

val ktor_version = "1.3.1"

repositories {
    mavenCentral()
    jcenter()
}

dependencies {
    implementation(kotlin("stdlib-jdk8"))
    compile("io.ktor:ktor-server-core:$ktor_version")
    compile("io.ktor:ktor-server-netty:$ktor_version")
    compile("ch.qos.logback:logback-classic:1.2.3")
    testCompile(group = "junit", name = "junit", version = "4.12")
}

tasks {
    compileKotlin {
        kotlinOptions.jvmTarget = "1.8"
    }
    compileTestKotlin {
        kotlinOptions.jvmTarget = "1.8"
    }
}

application {
    mainClassName = "io.ktor.server.netty.EngineMain"
} 

What am I doing wrong?

The Java runtime:

 java -version
openjdk version "1.8.0_242"
OpenJDK Runtime Environment (Zulu 8.44.0.11-CA-linux64) (build 1.8.0_242-b20)
OpenJDK 64-Bit Server VM (Zulu 8.44.0.11-CA-linux64) (build 25.242-b20, mixed mode)
like image 438
softshipper Avatar asked Feb 23 '20 22:02

softshipper


1 Answers

Switching from debug level to info or warn will hide this information.

If in the log further down there is

DEBUG io.netty.util.internal.NativeLibraryLoader - Successfully loaded the library /tmp/libnetty_transport_native_epoll_x86_646903432541420558.so

you're safe and should ignore the message (further up)

DEBUG io.netty.util.internal.NativeLibraryLoader - netty_transport_native_epoll_x86_64 cannot be loaded from java.library.path

It appears as a kind of try and error approach until an valid option is found, and it is tagged as an DEBUG message, so less relevant for library users which could go to INFO or WARNING log level or try suppressing this specific message.

See also here and here

like image 70
Hartmut Pfarr Avatar answered Nov 17 '22 19:11

Hartmut Pfarr