jsevellec / cassandra-unit

Utility tool to load Data into Cassandra to help you writing good isolated JUnit Test into your application
GNU Lesser General Public License v3.0
424 stars 0 forks source link

Using cassandra-unit with M1 (ARM64), JDK11 and cassandra v3 #342

Open aaroncoville opened 2 years ago

aaroncoville commented 2 years ago

I ran across a few issues mentioned for this library and wanted to share a solution that worked for me. Your mileage may vary.

I have an application that is still using cassandra-unit v3.11.2.0. This will not work as-is with JDK11 and/or M1 mac and you are likely to see an error along the lines of

CassandraDaemon.java - The native library could not be initialized properly.

The root issue, at least for me, was that the JNA version included with cassandra-unit v3.11.2.0 is not compatible.

Someone could potentially create a new release here with an updated JNA version but I went a simpler route by using gradle to forcibly update the jna transitive dependency.

configurations.all {
    resolutionStrategy.eachDependency { details ->
        if( details.requested.name == 'jna') {
            details.useTarget "net.java.dev.jna:jna:5.8.0"
        }
    }
}

With this change cassandra-unit v3.11.2.0 runs using JDK11 on an M1 ARM64 Mac.

I hope this helps someone.

If not, I apologize in advance for wasting your time.