Full ERROR Message Example
ERROR [main] 2017-08-23 09:48:21,467 NativeLibraryLinux.java:62 - Failed to link the C library against JNA. Native methods will be unavailable.
Typically followed by the following exception that provides more details about why the error occurred.
ERROR [main] 2017-08-23 09:48:21,467 NativeLibraryLinux.java:62 - Failed to link the C library against JNA. Native methods will be unavailable.
java.lang.UnsatisfiedLinkError: /tmp/jna-1367560132/jna4859101025087222330.tmp: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /tmp/jna-1367560132/jna4859101025087222330.tmp)
at java.lang.ClassLoader$NativeLibrary.load(Native Method) ~[na:1.8.0_71]
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1938) ~[na:1.8.0_71]
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1821) ~[na:1.8.0_71]
at java.lang.Runtime.load0(Runtime.java:809) ~[na:1.8.0_71]
at java.lang.System.load(System.java:1086) ~[na:1.8.0_71]
at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:947) ~[jna-4.4.0.jar:4.4.0 (b0)]
at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:922) ~[jna-4.4.0.jar:4.4.0 (b0)]
at com.sun.jna.Native.<clinit>(Native.java:190) ~[jna-4.4.0.jar:4.4.0 (b0)]
at org.apache.cassandra.utils.NativeLibraryLinux.<clinit>(NativeLibraryLinux.java:53) ~[apache-cassandra-3.11.0.jar:3.11.0]
at org.apache.cassandra.utils.NativeLibrary.<clinit>(NativeLibrary.java:93) [apache-cassandra-3.11.0.jar:3.11.0]
at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:196) [apache-cassandra-3.11.0.jar:3.11.0]
at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:600) [apache-cassandra-3.11.0.jar:3.11.0]
at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:689) [apache-cassandra-3.11.0.jar:3.11.0]
ERROR [main] 2017-08-23 09:48:21,470 CassandraDaemon.java:706 - The native library could not be initialized properly
What does this error mean?
The error means that JNA could not initialize the C library. JNA (Java Native Access) is a library that allows Java programs to access native library functions written in C. Cassandra uses JNA for several functions which are not available directly through Java:
- fsync, which causes cached writes to be immediately flushed to disk. If a power outage occurs before a write is flushed to disk, there is a chance of data loss. Usually flushes occur quickly even without an explicit fsync so the chance of data loss is small, but it is possible.
- mlockall, which prohibits the kernel from swapping out the memory used by the Cassandra process. If the memory of a Java program has been swapped to disk, it can cause long garbage collection pauses if the memory to be collected is swapped out. For this reason, swap should be disabled when running Cassandra. Calling mlockall prevents Cassandra from being swapped to disk even if swap is enabled on the system.
Why does this error occur?
This error occurs if the version of JNA in Cassandra requires a newer version of glibc than the OS provides. This typically occurs on older versions of Red Hat Enterprise Linux or CentOS 6.x, which ship with glibc 2.12 instead of glibc 2.14.
JNA is built against a specific version of glibc (the native C library) on the host system. Newer versions of glibc are backwards compatible with programs built against an older version, but the reverse is not true. Cassandra 3.11.0 included a version of JNA which required glibc 2.14. This was fixed in newer versions by compiling a custom JNA build for Cassandra that is compatible with glibc 2.12.
How do you fix this error?
Upgrading to the latest minor release for your version of Cassandra or DSE should fix the error. If you have concerns about upgrading or if the error still occurs after upgrading, please contact DataStax support.