Chronicle-Core icon indicating copy to clipboard operation
Chronicle-Core copied to clipboard

Java 17

Open ekaterinadimitrova2 opened this issue 3 years ago • 5 comments

I am working to migrate the cassandra project to Java 17. I updated all our chronicle dependencies to the latest version. Here is a reference to the build file: https://github.com/ekaterinadimitrova2/cassandra/blob/16895-v3/build.xml#L141-L145 But I still get the below error: error: module java.base does not open java.lang.reflect to unnamed module @52f27fbd -- StackTrace -- java.lang.IllegalAccessException: module java.base does not open java.lang.reflect to unnamed module @52f27fbd at java.base/java.lang.invoke.MethodHandles.privateLookupIn(MethodHandles.java:259) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at net.openhft.chronicle.core.Jvm.getSetAccessible0Method(Jvm.java:224) at net.openhft.chronicle.core.Jvm.(Jvm.java:134) at net.openhft.chronicle.core.io.AbstractReferenceCounted.(AbstractReferenceCounted.java:16) at net.openhft.chronicle.bytes.BytesStore.wrap(BytesStore.java:104) at net.openhft.chronicle.bytes.BytesStore.from(BytesStore.java:90) at net.openhft.chronicle.wire.WireType.(WireType.java:354) at net.openhft.chronicle.queue.impl.single.SingleChronicleQueueBuilder.binary(SingleChronicleQueueBuilder.java:222) at net.openhft.chronicle.queue.impl.single.SingleChronicleQueueBuilder.binary(SingleChronicleQueueBuilder.java:218) at net.openhft.chronicle.queue.impl.single.SingleChronicleQueueBuilder.single(SingleChronicleQueueBuilder.java:206) at org.apache.cassandra.fqltool.commands.Replay.lambda$replay$3(Replay.java:122) at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682) at org.apache.cassandra.fqltool.commands.Replay.replay(Replay.java:122) at org.apache.cassandra.fqltool.commands.Replay.run(Replay.java:92) at org.apache.cassandra.fqltool.FullQueryLogTool.main(FullQueryLogTool.java:65)

I also already added on our end (I saw recommendations on other chronicle issues) --add-opens java.base/jdk.internal.reflect=ALL-UNNAMED and --add-exports java.base/java.lang.reflect=ALL-UNNAMED but I still get the same error. Please advise as this is a blocker for me. Thank you in advance for your support!

ekaterinadimitrova2 avatar Mar 17 '22 16:03 ekaterinadimitrova2

Hi @ekaterinadimitrova2 and thanks for your question. Did you read this article on the topic:

https://chronicle.software/chronicle-support-java-17/

minborg avatar Mar 17 '22 17:03 minborg

Thank you so much for the quick response and the article. I ended up calling java with the exports mentioned plus --add-opens=java.base/java.lang.reflect=ALL-UNNAMED That solved most of my problems in that area.

ekaterinadimitrova2 avatar Mar 18 '22 14:03 ekaterinadimitrova2

Below is an excerpt from Cassandra pom:

 <dependency>
        <groupId>net.openhft</groupId>
        <artifactId>chronicle-queue</artifactId>
        <version>5.23.37</version>
        <exclusions>
          <exclusion>
            <artifactId>tools</artifactId>
            <groupId>com.sun</groupId>
          </exclusion>
          <exclusion>
              <!-- pulls in affinity-3.23ea1 which pulls in third-party-bom-3.22.4-SNAPSHOT -->
            <groupId>net.openhft</groupId>
            <artifactId>affinity</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>net.openhft</groupId>
        <artifactId>chronicle-core</artifactId>
        <version>2.23.36</version>
        <exclusions>
          <exclusion>
            <artifactId>chronicle-analytics</artifactId>
            <groupId>net.openhft</groupId>
          </exclusion>
          <exclusion>
            <artifactId>annotations</artifactId>
            <groupId>org.jetbrains</groupId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>net.openhft</groupId>
        <artifactId>chronicle-bytes</artifactId>
        <version>2.23.33</version>
        <exclusions>
          <exclusion>
            <artifactId>annotations</artifactId>
            <groupId>org.jetbrains</groupId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>net.openhft</groupId>
        <artifactId>chronicle-wire</artifactId>
        <version>2.23.39</version>
        <exclusions>
          <exclusion>
            <artifactId>compiler</artifactId>
            <groupId>net.openhft</groupId>
          </exclusion>
          <exclusion>
              <!-- pulls in affinity-3.23ea1 which pulls in third-party-bom-3.22.4-SNAPSHOT -->
            <groupId>net.openhft</groupId>
            <artifactId>affinity</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>net.openhft</groupId>
        <artifactId>chronicle-threads</artifactId>
        <version>2.23.25</version>
        <exclusions>
          <exclusion>
              <!-- pulls in affinity-3.23ea1 which pulls in third-party-bom-3.22.4-SNAPSHOT -->
            <groupId>net.openhft</groupId>
            <artifactId>affinity</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <!-- transitive to chronicle-queue, declared explicit to use newer version -->
        <groupId>net.openhft</groupId>
        <artifactId>affinity</artifactId>
        <version>3.23.3</version>
      </dependency>
      <dependency>
        <!-- transitive to chronicle-queue, declared explicit to use newer version -->
        <groupId>net.openhft</groupId>
        <artifactId>posix</artifactId>
        <version>2.24ea4</version>
      </dependency>
  We added the add-opens, add-exports as per the article recommended: https://chronicle.software/chronicle-support-java-17/
  
  So far things work well, but there is a recent concern raised by a user that they get on startup using JRE:
     WARNING: Unknown module: jdk.compiler specified to --add-exports
WARNING: Unknown module: jdk.compiler specified to --add-opens

I am evaluating the impact of those modules missing. Can you advise me, please?

ekaterinadimitrova2 avatar Nov 07 '23 01:11 ekaterinadimitrova2

minborg Do you have any idea whether we should expect performance degradation, or runtime exceptions, or both?

ekaterinadimitrova2 avatar Nov 08 '23 22:11 ekaterinadimitrova2

Hi @ekaterinadimitrova2 . Unless you see a warning like following

Failed to compile generated method reader - falling back to proxy method reader. Please report this failure as support for proxy method readers will be dropped in x.25.

there should be no performance impact. As com.sun.tools.javac package is used by the Compiler (which you exclude) and subsequently by Wire/Queue for compiling some optimized autogenerated classes.

yevgenp avatar Jan 16 '24 13:01 yevgenp