Installed Cassandra on Windows 11, getting IllegalAccessError: "Cannot initialize un-mmaper" - cassandra

I am trying to install Cassandra on a Windows machine, with Java 1.8.
The Error message I am getting is the following:
ERROR [main] 2023-01-27 09:45:26,820 FileUtils.java:80 - Cannot initialize un-mmaper. (Are you using a non-Oracle JVM?) Compacted data files will not be removed promptly. Consider using an Oracle JVM or using standard disk access mode
java.lang.IllegalAccessError: class org.apache.cassandra.io.util.FileUtils (in unnamed module #0x6aa8e115) cannot access class sun.nio.ch.DirectBuffer (in module java.base) because module java.base does not export sun.nio.ch to unnamed module #0x6aa8e115
at org.apache.cassandra.io.util.FileUtils.<clinit>(FileUtils.java:75)
at org.apache.cassandra.config.DatabaseDescriptor.guessFileStore(DatabaseDescriptor.java:1093)
at org.apache.cassandra.config.DatabaseDescriptor.applySimpleConfig(DatabaseDescriptor.java:493)
at org.apache.cassandra.config.DatabaseDescriptor.applyAll(DatabaseDescriptor.java:324)
at org.apache.cassandra.config.DatabaseDescriptor.daemonInitialization(DatabaseDescriptor.java:153)
at org.apache.cassandra.config.DatabaseDescriptor.daemonInitialization(DatabaseDescriptor.java:137)
at org.apache.cassandra.service.CassandraDaemon.applyConfig(CassandraDaemon.java:680)
at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:622)
at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:786)
INFO [main] 2023-01-27 09:45:26,944 RateBasedBackPressure.java:123 - Initialized back-pressure with high ratio: 0.9, factor: 5, flow: FAST, window size: 2000.
INFO [main] 2023-01-27 09:45:26,945 DatabaseDescriptor.java:781 - 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 #0x6aa8e115) cannot access class sun.rmi.registry.RegistryImpl (in module java.rmi) because module java.rmi does not export sun.rmi.registry to unnamed module #0x6aa8e115
java.lang.IllegalAccessError: superclass access check failed: class org.apache.cassandra.utils.JMXServerUtils$JmxRegistry (in unnamed module #0x6aa8e115) cannot access class sun.rmi.registry.RegistryImpl (in module java.rmi) because module java.rmi does not export sun.rmi.registry to unnamed module #0x6aa8e115
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1013)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:862)
at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:760)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:681)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:639)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
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] 2023-01-27 09:45:27,067 CassandraDaemon.java:803 - Exception encountered during startup
java.lang.IllegalAccessError: superclass access check failed: class org.apache.cassandra.utils.JMXServerUtils$JmxRegistry (in unnamed module #0x6aa8e115) cannot access class sun.rmi.registry.RegistryImpl (in module java.rmi) because module java.rmi does not export sun.rmi.registry to unnamed module #0x6aa8e115
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1013)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:862)
at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:760)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:681)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:639)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
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)
after which it exists with the message: Main Completed.
Can anyone help me with this?

Compatibility
The multiple IllegalAccessError messages indicate to me that you are running an unsupported version of Java that is not compatible with Cassandra.
You stated that you are running Java 8 but there's a chance that you have a newer version installed on your machine and JAVA_HOME is pointing at the newer version.
Java support
Cassandra 3.0/3.11 and earlier versions only supports Java 8. Cassandra 4.0 added support for Java 11 LTS (CASSANDRA-9608) so C* 4.x will work with either Java 8 or Java 11.
Provided that you have a supported version of Java installed, I've seen issues with some flavours of Java which do not seem to be compatible with Cassandra. My recommendation is to install a TCK-certified flavour of Java such as Oracle JVM or OpenJDK.
Windows support
For what it's worth, The Java file I/O library that Cassandra uses has always been problematic on Windows particularly with NTFS. It has been a constant source of issues for users that we decided it wasn't good for the project to continue support (see the discussion in this thread).
We eventually dropped Windows support completely in Cassandra 4.0 (CASSANDRA-16171).
Alternatives
The recommended workarounds for Windows users are:
Deploy Cassandra in Docker
Deploy Cassandra in a VM using software like VirtualBox
Deploy Cassandra in a Kubernetes cluster with open-source K8ssandra.io
Otherwise if you just want to learn how to build apps on Cassandra, Astra DB has a free tier where you can launch a cluster in just 5 clicks with no credit card required. Cheers!

Related

Cassandra trigger jar is loading but not executing the class

I have created the custom trigger.jar and placed in the directory where Cassandra service can read the same, after performing the "nodetool realoadtriggers" it just prints "Loading new /trigger.jar" in system.log, but it's not executing the java class in the jar.
Note: Also, I have created the trigger on the table which should trigger this custom trigger jar on writing the inserting the data to the table, but it's not loading the class
The java class implements ITrigger overrides argument method. Any pointers for debugging the same will be helpful.
Cassandra verison - DSE 6.7.5
From the DSE 6.0 upgrade guide:
The org.apache.cassandra.triggers.ITrigger interface was modified from augment to augmentNonBlocking for non-blocking internal architecture. Updated trigger implementations must be provided on upgraded nodes.
So you need to change your implementation to comply.

Spring Data Flow Kubernetes JDBC Drivers

I'm trying to deploy an jdbc-sink to a Helm based Kuberentes install of Spring Cloud Data Flow.
How would I go about adding JDBC jars in order to make use of the starters? I'm getting the following error when trying to deploy the app (in this case MySQL):
***************************
APPLICATION FAILED TO START
***************************
Description:
Failed to bind properties under '' to com.zaxxer.hikari.HikariDataSource:
Property: driverclassname
Value: com.mysql.cj.jdbc.Driver
Origin: "driverClassName" from property source "source"
Reason: Failed to load driver class com.mysql.cj.jdbc.Driver in either of HikariConfig class loader or Thread context classloader
Would I need to extend the existing starter, and manually add the Driver as there's no way of guaranteeing which driver it should be using?
Thanks!
We ship the OSS license-friendly drivers for few databases in SCDF and the app-starters that require database access, including the jdbc applications.
For proprietary drivers, there's a procedure to patch the out-of-the-box app-starters that we maintain and ship — more details in the reference guide here.
Once when you bundle the relevant driver in the classpath, you'd produce a docker image to then use it in SCDF.

cassandra version compatibility with 3.7?

Is the spring-data-cassandra version 1.4.2 compatible with cassandra version 3.7? I get the following error when I try to connect:
Error creating bean with name 'cassandraSession': Invocation of init method failed;
nested exception is java.lang.NoClassDefFoundError:
io/netty/util/concurrent/EventExecutor
No, Spring Data Cassandra 1.4.x is based on the 2.x DataStax's Cassandra driver.
However, in Spring Data Cassandra 1.5 (Ingalls) release series (currently at 1.5 M1), we have upgraded the DataStax Cassandra driver to 3.0.3. We have also removed support for the DataStax DSE (DataStax Enterprise) driver since it is unnecessary for SD Cassandra functionality.
There were significant changes in the 3.0 version of DataStax's Java driver API requiring us to introduce 3.0 support in 1.5. We would not be able to back port these changes without adversely affecting 1.4 users.
You can find out more by reading our SD Ingalls M1 release announcement.
Also, you can follow the development of SD Cassandra 1.5 on the Wiki.
Feedback is always welcomed, either with PRs or through JIRA.

Can't connect to local cassandra via java driver

(neophyte question) I've just installed cassandra 3.5 (on linux, using the generic package). At present, it's a completely vanilla installation - I haven't modified the conf file and haven't created or added anything yet.
I can connect using cqlsh but not using the javax java driver (version 2.0.2). E.g. if I run
BasicConfigurator.configure();
Cluster cluster = Cluster.builder().addContactPoint("127.0.0.1").build();
System.out.println("\nCluster name: " + cluster.getClusterName()+"\n");
Session session = cluster.connect();
the result is
0 [main] DEBUG com.datastax.driver.core.Cluster - Starting new cluster with contact points [/127.0.0.1:9042]
Cluster name: cluster1
112 [New I/O worker #1] DEBUG com.datastax.driver.core.Connection - Defuncting connection to /127.0.0.1:9042
com.datastax.driver.core.TransportException: [/127.0.0.1:9042] Unexpected exception triggered (java.lang.IndexOutOfBoundsException: Not enough readable bytes - Need 4, maximum is 0)
at com.datastax.driver.core.Connection$Dispatcher.exceptionCaught(Connection.java:601)
at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:112)
...
The exception is being thrown by cluster.connect().
I suspect I've left something out. Any suggestions would be appreciated. Thanks.
datastax java driver 2.0.2 is not capable of connecting to cassandra 3.x+ clusters. Upgrading to 3.0.x (i.e. 3.0.2 which is the latest) should resolve this issue.
For future reference you can see what versions of C* are supported with driver versions on the DataStax drivers matrix page.

org.jboss.netty.channel.ChannelPipelineException: Failed to initialize a pipeline

I have an application that connects to Cassandra using the Java Driver, fetches some configuration and based on the results generates and executes some PIG scripts.
Now, I am able to successfully connect to Cassandra, when jars required for PIG are not in the classpath. Similarly, I am able to launch PigServer class and execute scripts / statements using the entire DSE stack when I am not connecting to Cassandra using the java driver to retrieve the configuration.
When I use both of them I get following exception:
org.jboss.netty.channel.ChannelPipelineException: Failed to initialize a pipeline.
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:181)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:570)
... 35 more
Caused by: org.jboss.netty.channel.ChannelPipelineException: Failed to initialize a pipeline.
at org.jboss.netty.bootstrap.ClientBootstrap.connect(ClientBootstrap.java:208)
at org.jboss.netty.bootstrap.ClientBootstrap.connect(ClientBootstrap.java:182)
at com.datastax.driver.core.Connection.<init>(Connection.java:100)
at com.datastax.driver.core.Connection.<init>(Connection.java:51)
at com.datastax.driver.core.Connection$Factory.open(Connection.java:376)
at com.datastax.driver.core.ControlConnection.tryConnect(ControlConnection.java:207)
at com.datastax.driver.core.ControlConnection.reconnectInternal(ControlConnection.java:170)
at com.datastax.driver.core.ControlConnection.connect(ControlConnection.java:87)
at com.datastax.driver.core.Cluster$Manager.init(Cluster.java:576)
at com.datastax.driver.core.Cluster$Manager.access$100(Cluster.java:520)
at com.datastax.driver.core.Cluster.<init>(Cluster.java:67)
at com.datastax.driver.core.Cluster.buildFrom(Cluster.java:94)
at com.datastax.driver.core.Cluster$Builder.build(Cluster.java:501)
I see others have seen similar exception, but when trying to execute Cassandra statements, from MapReduce tasks, which is not my case:
https://groups.google.com/a/lists.datastax.com/forum/#!topic/java-driver-user/FhW_8e4FyAI
http://www.datastax.com/dev/blog/the-native-cql-java-driver-goes-ga#comment-297187
Thanks!
DSE stacks connect to Cassandra through thrift API which is different from Cassandra Java Driver.
You can't use Cassandra Java driver for Pig/Hadoop before CASSANDRA-6311 is resolved.
There may be the bad security certificate/security certificate expiration issue if you are using certificate.

Resources