我在JDK 9上使用Ignite时遇到问题。我有以下最小的测试用例:
package no.ovstetun.ignite;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.junit.Test;
public class FailingIgniteTest {
@Test
public void failingIgnite() {
TcpDiscoverySpi discoverySpi = new TcpDiscoverySpi();
}
}
此代码示例失败,显示以下堆栈跟踪:
java.lang.ExceptionInInitializerError
at org.apache.ignite.internal.util.IgniteUtils.<clinit>(IgniteUtils.java:769)
at org.apache.ignite.spi.IgniteSpiAdapter.<init>(IgniteSpiAdapter.java:119)
at org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi.<init>(TcpDiscoverySpi.java:231)
at no.nrk.mdb.common.infrastructure.ignite.IgniteConfigurationTest.failingIgnite(IgniteConfigurationTest.java:10)
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:564)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
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: jdk.internal.misc.JavaNioAccess class is unavailable.
at org.apache.ignite.internal.util.GridUnsafe.javaNioAccessObject(GridUnsafe.java:1453)
at org.apache.ignite.internal.util.GridUnsafe.<clinit>(GridUnsafe.java:112)
... 26 more
Caused by: java.lang.IllegalAccessException: class org.apache.ignite.internal.util.GridUnsafe cannot access class jdk.internal.misc.SharedSecrets (in module java.base) because module java.base does not export jdk.internal.misc to unnamed module @31ef45e3
at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:361)
at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:589)
at java.base/java.lang.reflect.Method.invoke(Method.java:556)
at org.apache.ignite.internal.util.GridUnsafe.javaNioAccessObject(GridUnsafe.java:1450)
... 27 more
我正在尝试将我的代码库迁移到Java 8之外,而Ignite现在是阻止我的唯一依赖。我尝试将--add-module
添加到我的跑步者,但我似乎无法找到使Ignite与JDK 9一起工作所需的内容。
与Ignite版本2.4.0和2.5.0相同的错误。
非常感谢任何帮助!
答案 0 :(得分:4)
尝试在启动Java时添加以下参数:
.select-organization > a:nth-child(1)
答案 1 :(得分:2)
作为VM参数的替代方法,您可以在库的META-INF / MANIFEST.MF中指定--add-exports
:
Add-Exports: java.base/jdk.internal.misc