Getting AccessDeniedException when running embedded cassandra with Azul jdk 11

Viewed 308

I am trying to run embedded Cassandra using cassandra-unit library in Azul JDK 11 with Gradle project and getting following AccessDenindException. I've checked the permissions of the build folder it is not readonly and there are some files already. Don't have anything else in the project which might causing the issue.

org.apache.cassandra.io.FSWriteError: java.nio.file.AccessDeniedException: build\embeddedCassandra\commitlog\CommitLog-6-1642719269564.log
    at org.apache.cassandra.io.util.FileUtils.deleteWithConfirm(FileUtils.java:143)
    at org.apache.cassandra.io.util.FileUtils.deleteWithConfirm(FileUtils.java:160)
    at org.apache.cassandra.db.commitlog.CommitLogSegment.discard(CommitLogSegment.java:409)

Java class

EmbeddedCassandraServerHelper.startEmbeddedCassandra();

build.gradle

testCompile 'org.cassandraunit:cassandra-unit:4.3.1.0'
testCompile 'com.datastax.oss:java-driver-core:4.13.0'
1 Answers

There isn't any magic that happens here since Cassandra is simply using the Java IO utilities so this is a low-level filesystem issue.

One of the things to check for is whether the existing commit logs in the directory are owned by a different user that the Cassandra process does not have access to. For example, CommitLog-6-1642719269564.log is owned by root but the C* process is running with cassandra. If so, you will need to change the file ownership. Cheers!

[UPDATE] Java 11 is only supported from Cassandra 4.x. Earlier versions of Cassandra only work with Java 8.

Related