Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-15468

Unable to start embedded cassandra on JDK 11

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • 4.0-alpha3, 4.0
    • None
    • None

    Description

      Cassandra fails to start without the following jvm options from jvm-11-server.options:

      -Djdk.attach.allowAttachSelf=true
      --add-exports java.base/jdk.internal.misc=ALL-UNNAMED
      --add-exports java.base/jdk.internal.ref=ALL-UNNAMED
      --add-exports java.base/sun.nio.ch=ALL-UNNAMED
      --add-exports java.management.rmi/com.sun.jmx.remote.internal.rmi=ALL-UNNAMED
      --add-exports java.rmi/sun.rmi.registry=ALL-UNNAMED
      --add-exports java.rmi/sun.rmi.server=ALL-UNNAMED
      --add-exports java.sql/java.sql=ALL-UNNAMED
      
      --add-opens java.base/java.lang.module=ALL-UNNAMED
      --add-opens java.base/jdk.internal.loader=ALL-UNNAMED
      --add-opens java.base/jdk.internal.ref=ALL-UNNAMED
      --add-opens java.base/jdk.internal.reflect=ALL-UNNAMED
      --add-opens java.base/jdk.internal.math=ALL-UNNAMED
      --add-opens java.base/jdk.internal.module=ALL-UNNAMED
      --add-opens java.base/jdk.internal.util.jar=ALL-UNNAMED
      --add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED
      

      Without these options the following stack trace appears and prevents startup

      2020-01-05T17:42:15,009 ERROR main org.apache.cassandra.service.CassandraDaemon Exception encountered during startup java.lang.ExceptionInInitializerError
      	at org.apache.cassandra.config.DatabaseDescriptor.guessFileStore(DatabaseDescriptor.java:1127)
      	at org.apache.cassandra.config.DatabaseDescriptor.applySimpleConfig(DatabaseDescriptor.java:541)
      	at org.apache.cassandra.config.DatabaseDescriptor.applyAll(DatabaseDescriptor.java:340)
      	at org.apache.cassandra.config.DatabaseDescriptor.daemonInitialization(DatabaseDescriptor.java:168)
      	at org.apache.cassandra.config.DatabaseDescriptor.daemonInitialization(DatabaseDescriptor.java:152)
      	at org.apache.cassandra.service.CassandraDaemon.applyConfig(CassandraDaemon.java:665)
      	at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:609)
      	at org.jesterj.ingest.persistence.Cassandra.start(Cassandra.java:135)
      	at org.jesterj.ingest.scanners.SimpleFileScannerImplFTITest.testScanWithMemory(SimpleFileScannerImplFTITest.java:63)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
      	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
      	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
      	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
      	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
      	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
      	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
      	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
      	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
      	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
      	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
      	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
      	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
      	at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
      	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
      	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
      	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
      	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
      Caused by: java.lang.RuntimeException: java.lang.IllegalAccessException: access to public member failed: jdk.internal.ref.Cleaner.clean[Ljava.lang.Object;@779dfe55/invokeVirtual, from org.apache.cassandra.io.util.FileUtils (unnamed module @2eda0940)
      	at org.apache.cassandra.io.util.FileUtils.<clinit>(FileUtils.java:95)
      	... 33 more
      Caused by: java.lang.IllegalAccessException: access to public member failed: jdk.internal.ref.Cleaner.clean[Ljava.lang.Object;@779dfe55/invokeVirtual, from org.apache.cassandra.io.util.FileUtils (unnamed module @2eda0940)
      	at java.base/java.lang.invoke.MemberName.makeAccessException(MemberName.java:942)
      	at java.base/java.lang.invoke.MethodHandles$Lookup.checkAccess(MethodHandles.java:2206)
      	at java.base/java.lang.invoke.MethodHandles$Lookup.checkMethod(MethodHandles.java:2146)
      	at java.base/java.lang.invoke.MethodHandles$Lookup.getDirectMethodCommon(MethodHandles.java:2290)
      	at java.base/java.lang.invoke.MethodHandles$Lookup.getDirectMethodNoSecurityManager(MethodHandles.java:2283)
      	at java.base/java.lang.invoke.MethodHandles$Lookup.unreflect(MethodHandles.java:1747)
      	at org.apache.cassandra.io.util.FileUtils.<clinit>(FileUtils.java:86)
      	... 33 more
      

      Use of --add-exports is described in the oracle documentation as

      You may use the --add-exports option as a temporary workaround to compile source code with references to JDK internal classes.

      which implies that this will not work forever. Also the code in FileUtils seems somewhat confused as it prints out a warning, as if it means to allow startup with a lower performance expectation, and then throws an exception that entirely prevents startup.

      Attachments

        1. CASSANDRA-15468.patch
          2 kB
          Gus Heck

        Activity

          People

            gus Gus Heck
            gus Gus Heck
            Gus Heck
            Sam Tunnicliffe
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: