Upsource 2017.2 Help

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

The error occurs on the Cassandra database startup. Cassandra 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:

  • Remount the tmp directory without the noexec flag.

    or

  • Configure Cassandra to use another location as a temporary directory. To do that...

    ...for a ZIP installation:

    1. Stop Upsource: <upsource_home>/bin/upsource.sh stop

    2. Run the following command:

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

    ...for a Docker installation:

    1. Stop Upsource: docker exec <containerId> stop

    2. Run the following command:

      docker run -it -v <path to data directory>:/opt/upsource/data \ -v <path to conf directory>:/opt/upsource/conf \ -v <path to logs directory>:/opt/upsource/logs \ -v <path to backups directory>:/opt/upsource/backups \ -p <port on host>:XXXX \ --entrypoint=/bin/bash jetbrains/upsource:<version> \ /opt/upsource/apps/cassandra/bin/cassandra.sh \ configure -J-Djava.io.tmpdir=$HOME
Last modified: 10 September 2017