Bringing together the Apache Cassandra experts from the community and DataStax.

Want to learn? Have a question? Want to share your expertise? You are in the right place!

Not sure where to begin? Getting Started

 

question

anthonychernyak avatar image
anthonychernyak asked Erick Ramirez answered

Getting IllegalAccessError when launching Cassandra on MacOS

Hi, I am trying to get Cassandra setup on my local machine, but after going through setup and attempting to launch, I get several java.lang.IllegalAccessError. From searching, I haven't seen any other errors in a similar fashion, and am at a loss at what to do?

System Info:

  • Mac OS 10.15.7, Late 2019 Model
  • Java 16.0.2
  • Have tried both with and without root access.
java.lang.IllegalAccessError: class org.apache.cassandra.io.util.FileUtils (in unnamed module @0x71687585) cannot access class sun.nio.ch.DirectBuffer (in module java.base) because module java.base does not export sun.nio.ch to unnamed module @0x71687585
    at org.apache.cassandra.io.util.FileUtils.<clinit>(FileUtils.java:75) ~[apache-cassandra-3.11.11.jar:3.11.11]
    at org.apache.cassandra.config.DatabaseDescriptor.guessFileStore(DatabaseDescriptor.java:1087) ~[apache-cassandra-3.11.11.jar:3.11.11]
    at org.apache.cassandra.config.DatabaseDescriptor.applySimpleConfig(DatabaseDescriptor.java:493) ~[apache-cassandra-3.11.11.jar:3.11.11]
    at org.apache.cassandra.config.DatabaseDescriptor.applyAll(DatabaseDescriptor.java:324) ~[apache-cassandra-3.11.11.jar:3.11.11]
    at org.apache.cassandra.config.DatabaseDescriptor.daemonInitialization(DatabaseDescriptor.java:153) ~[apache-cassandra-3.11.11.jar:3.11.11]
    at org.apache.cassandra.config.DatabaseDescriptor.daemonInitialization(DatabaseDescriptor.java:137) ~[apache-cassandra-3.11.11.jar:3.11.11]
    at org.apache.cassandra.service.CassandraDaemon.applyConfig(CassandraDaemon.java:680) ~[apache-cassandra-3.11.11.jar:3.11.11]
    at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:622) ~[apache-cassandra-3.11.11.jar:3.11.11]
    at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:786) ~[apache-cassandra-3.11.11.jar:3.11.11]
INFO [main] 2021-09-28 14:02:28,984 RateBasedBackPressure.java:123 - Initialized back-pressure with high ratio: 0.9, factor: 5, flow: FAST, window size: 2000.
INFO [main] 2021-09-28 14:02:28,985 DatabaseDescriptor.java:775 - Back-pressure is disabled with strategy org.apache.cassandra.net.RateBasedBackPressure{high_ratio=0.9, factor=5, flow=FAST}.
Exception (java.lang.IllegalAccessError) encountered during startup: superclass access check failed: class org.apache.cassandra.utils.JMXServerUtils$JmxRegistry (in unnamed module @0x71687585) cannot access class sun.rmi.registry.RegistryImpl (in module java.rmi) because module java.rmi does not export sun.rmi.registry to unnamed module @0x71687585
java.lang.IllegalAccessError: superclass access check failed: class org.apache.cassandra.utils.JMXServerUtils$JmxRegistry (in unnamed module @0x71687585) cannot access class sun.rmi.registry.RegistryImpl (in module java.rmi) because module java.rmi does not export sun.rmi.registry to unnamed module @0x71687585
    at java.base/java.lang.ClassLoader.defineClass1(Native Method)
    at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1010)
    at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
    at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:855)
    at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:753)
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:676)
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:634)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:182)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:519)
    at org.apache.cassandra.utils.JMXServerUtils.createJMXServer(JMXServerUtils.java:80)
    at org.apache.cassandra.service.CassandraDaemon.maybeInitJmx(CassandraDaemon.java:159)
    at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:204)
    at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:633)
    at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:786)
ERROR [main] 2021-09-28 14:02:29,256 CassandraDaemon.java:803 - Exception encountered during startup
java.lang.IllegalAccessError: superclass access check failed: class org.apache.cassandra.utils.JMXServerUtils$JmxRegistry (in unnamed module @0x71687585) cannot access class sun.rmi.registry.RegistryImpl (in module java.rmi) because module java.rmi does not export sun.rmi.registry to unnamed module @0x71687585
    at java.base/java.lang.ClassLoader.defineClass1(Native Method) ~[na:na]
    at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1010) ~[na:na]
    at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150) ~[na:na]
    at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:855) ~[na:na]
    at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:753) ~[na:na]
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:676) ~[na:na]
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:634) ~[na:na]
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:182) ~[na:na]
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:519) ~[na:na]
    at org.apache.cassandra.utils.JMXServerUtils.createJMXServer(JMXServerUtils.java:80) ~[apache-cassandra-3.11.11.jar:3.11.11]
    at org.apache.cassandra.service.CassandraDaemon.maybeInitJmx(CassandraDaemon.java:159) ~[apache-cassandra-3.11.11.jar:3.11.11]
    at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:204) ~[apache-cassandra-3.11.11.jar:3.11.11]
    at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:633) ~[apache-cassandra-3.11.11.jar:3.11.11]
    at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:786) ~[apache-cassandra-3.11.11.jar:3.11.11]
installation
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered

Only Java 8 is supported with Cassandra 3.11 as I've documented in the Prerequisites section of the Installation instructions at the Apache website.

Java 11 support is tagged experimental for Cassandra 4.0 but we're looking to remove that soon. The goal is to support Java 11 + Java 17 LTS for future Cassandra 4.x+ releases. Cheers!

Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.