1

I am trying to start Apache Cassandra 3.11.2 on Centos 7 and I get error Exception:

ERROR [main] 2023-02-22 11:19:03,067 NativeLibraryLinux.java:64 - Failed to link the C library against JNA. Native methods will be unavailable.
java.lang.UnsatisfiedLinkError: /tmp/jna-1073564104/jna8760917299733827163.tmp: /tmp/jna-1073564104/jna8760917299733827163.tmp: failed to map segment from shared object: Operation not permitted
        at java.lang.ClassLoader$NativeLibrary.load(Native Method)
        at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1937)
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1820)
        at java.lang.Runtime.load0(Runtime.java:782)
        at java.lang.System.load(System.java:1098)
        at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:851)
        at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:826)
        at com.sun.jna.Native.<clinit>(Native.java:140)
        at com.sun.jna.NativeLibrary.<clinit>(NativeLibrary.java:84)
        at org.apache.cassandra.utils.NativeLibraryLinux.<clinit>(NativeLibraryLinux.java:55)
        at org.apache.cassandra.utils.NativeLibrary.<clinit>(NativeLibrary.java:95)
        at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:212)
        at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:633)
        at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:786)
WARN  [main] 2023-02-22 11:19:03,067 StartupChecks.java:136 - jemalloc shared library could not be preloaded to speed up memory allocations
INFO  [main] 2023-02-22 11:19:03,067 StartupChecks.java:176 - JMX is enabled to receive remote connections on port: 7199
ERROR [main] 2023-02-22 11:19:03,068 CassandraDaemon.java:803 - The native library could not be initialized properly.

How do I fix this ?

2 Answers 2

1

Consider upgrading to 3.11.14. Apache Cassandra 3.11.2 is almost 5 years old, and I'm pretty sure the JNA library is included with it. That itself might fix this.

Otherwise, you should be able to clear out the /tmp/jna* files and restart.

It also might be that the Cassandra user doesn't have adequate permissions on the /tmp dir, so you could try redirecting that by adding this line to the end of the cassandra-env.sh file.

JVM_OPTS="$JVM_OPTS -Djava.io.tmpdir=$CASSANDRA_HOME/tmp"
2
  • 1
    Thank you very much, it helped: JVM_OPTS="$JVM_OPTS -Djava.io.tmpdir=$CASSANDRA_HOME/tmp"
    – Dmitrij
    Feb 22 at 14:47
  • @Dmitrij great to hear!
    – Aaron
    Feb 22 at 15:46
0

The UnsatisfiedLinkError happens because Cassandra doesn't have permissions to execute the shared libraries in the /tmp directory (mounted with the noexec option).

As a workaround, you can map the JNA temporary directory by adding the following line in Cassandra's conf/jvm.options file:

-Djna.tmpdir=/path/to/jna/tmp_directory

Note that the Cassandra process must have read, write and execute permissions on this directory. Cheers!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.