KB Article #179697

Cassandra startup failed; NoClassDefFoundError: Could not initialize class com.sun.jna.Native

Problem

Something changed and now Cassandra will not start up. With the following errors seen in CASSANDRA_INSTALL_DIR/logs system.log or debug.log:


Alternate error seen on more recent Cassandra versions:

ERROR [main] NativeLibraryLinux.java:64 - Failed to link the C library against JNA. Native methods will be unavailable.
java.lang.UnsatisfiedLinkError: /tmp/jna-[generated filename].tmp: /tmp/jna-[generated filename].tmp: failed to map segment from shared object  
   at java.lang.ClassLoader$NativeLibrary.load(Native Method)


Older errors seen:

ERROR [SSTableBatchOpen:1] 2018-08-09 11:05:37,425 DebuggableThreadPoolExecutor.java:242 - Error in ThreadPoolExecutor
java.lang.NoClassDefFoundError: Could not initialize class com.sun.jna.Native
at org.apache.cassandra.utils.memory.MemoryUtil.allocate(MemoryUtil.java:82) ~[apache-cassandra-2.2.8.jar:2.2.8]
at org.apache.cassandra.io.util.Memory.<init>(Memory.java:74) ~[apache-cassandra-2.2.8.jar:2.2.8]


ERROR [main] 2018-08-09 11:05:37,861 CassandraDaemon.java:654 - Exception encountered during startup

java.lang.RuntimeException: java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: Could not initialize class com.sun.jna.Native
[...]
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.sun.jna.Native
at org.apache.cassandra.utils.memory.MemoryUtil.allocate(MemoryUtil.java:82) ~[apache-cassandra-2.2.8.jar:2.2.8]
at org.apache.cassandra.io.util.Memory.<init>(Memory.java:74) ~[apache-cassandra-2.2.8.jar:2.2.8]


Resolution

7.7 docs mention of NOEXEC can be found here:

https://docs.axway.com/bundle/axway-open-docs/page...


Older answer:
The system was somehow updated to add NOEXEC permissions to the system temp directory. Pre 7.6.2, API GW and Cassandra require temp to be mounted with EXEC privileges, see pre-requisites in your Installation guide.

Solutions:

  • Pre 7.6.2, please re-mount temp directory with EXEC privileges.
  • Starting with 7.6.2, please see 7.6.2 Installation guide, sections: Additional prerequisites \ Post-installation
    [...]
    2. If you installed Cassandra during API Gateway installation,
    edit the file CASSANDRA_INSTALL_DIR/conf/cassandra-env.sh and add the following line:
    JVM_OPTS="$JVM_OPTS -Djava.io.tmpdir=<TheNewTmpDir>"