Chronicle-Core
Chronicle-Core copied to clipboard
Java 17
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.
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!
Hi @ekaterinadimitrova2 and thanks for your question. Did you read this article on the topic:
https://chronicle.software/chronicle-support-java-17/
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.
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?
minborg Do you have any idea whether we should expect performance degradation, or runtime exceptions, or both?
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.