Error: "Could not initialize class com.sun.jna.Native"

Overview:

This article describes how to resolve the "Could not initialize class com.sun.jna.Native" error, occurring during Cassandra startup.

 

Symptoms: 

Cassandra database throws the following exception while starting:

ERROR o.a.c.service.CassandraDaemon - Exception in thread Thread[MemtableFlushWriter:1,5,main]
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.4.jar:2.2.4]
at org.apache.cassandra.io.util.Memory.<init>(Memory.java:74) ~[apache-cassandra-clientutil-2.2.4.jar:2.2.4]
...

 

Solution:

This issue is typically caused by a noexec flag set on the temporary directory.

There are two possible ways to resolve the issue:

1. Remount tmp directory without noexec flag

2. Configure Cassandra to use another location as a temporary directory. To do that, run the following command:

<Upsource_home>/apps/cassandra/bin/cassandra.sh configure -J-Djava.io.tmpdir=$HOME

3 out of 7 found this helpful

Please sign in to leave a comment.

Have more questions?

Submit a request