Nicola Ferraro
Nicola Ferraro

Reputation: 4189

Check if JNA is enabled in Cassandra

I know from other posts that Cassandra writes some warning in log files if JNA is not configured properly. My log files (cassandra.log and system.log) do not contain the word "jna" (all case checked). Can I assume that JNA is configured correctly for my instance of Cassandra ?

Is there any way to check if the JNA configuration is correct ?

Upvotes: 9

Views: 3740

Answers (2)

Lyuben Todorov
Lyuben Todorov

Reputation: 14173

Below is the code that will display the error if JNA is missiing:

    try
    {
        Native.register("c");
    }
    catch (NoClassDefFoundError e)
    {
        logger.warn("JNA not found. Native methods will be disabled.");
        jnaAvailable = false;
    }
    catch (UnsatisfiedLinkError e)
    {
        logger.warn("JNA link failure, one or more native method will be unavailable.");
        logger.debug("JNA link failure details: {}", e.getMessage());
    }
    catch (NoSuchMethodError e)
    {
        logger.warn("Obsolete version of JNA present; unable to register C library. Upgrade to JNA 3.2.7 or later");
        jnaAvailable = false;
    }

So just grep your logs for one of the above.

Upvotes: 4

Aaron
Aaron

Reputation: 57798

If JNA is configured properly, you should see a message in your log like this:

INFO [main] 2014-06-06 15:55:11,664 CLibrary.java (line 121) JNA mlockall successful

Also in your log, the JNA library should appear in your classpath output:

INFO [main] 2014-06-06 16:47:13,318 CassandraDaemon.java (line 191) Classpath:...
....:/usr/share/java/jna.jar:

Upvotes: 6

Related Questions