javaignite

how to start apache Ignite 3 using embedded mode?


I want use how apache Ignite 3 in java application.

my java code is like this:

 Path path = Path.of("/opt/ignite/ignite.conf");
 Path workPath = Path.of("/tmp/ignite-repository");
 IgniteServer igniteServer = IgniteServer.start("node1", path, workPath);

ignite cofig file is

{
  ignite: {
    network: {
      port: 3344,
      nodeFinder: {
        netClusterNodes: [
          "node1:3344",
          "node2:3344",
          "node3:3344"
        ]
      }
    }
  }
}

and it throw ExceptionInInitializerError error

java.lang.ExceptionInInitializerError
at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:732)
at org.apache.ignite.internal.util.ExceptionUtils$10.copy(ExceptionUtils.java:967)
at org.apache.ignite.internal.util.ExceptionUtils$ExceptionFactory.createCopy(ExceptionUtils.java:789)
at org.apache.ignite.internal.util.ExceptionUtils.copyExceptionWithCause(ExceptionUtils.java:591)
at org.apache.ignite.internal.util.ExceptionUtils.copyExceptionWithCauseInternal(ExceptionUtils.java:724)
at org.apache.ignite.internal.util.ExceptionUtils.copyExceptionWithCause(ExceptionUtils.java:569)
at org.apache.ignite.internal.app.IgniteServerImpl.tryToCopyExceptionWithCause(IgniteServerImpl.java:465)
at org.apache.ignite.internal.app.IgniteServerImpl.sync(IgniteServerImpl.java:457)
at org.apache.ignite.internal.app.IgniteServerImpl.start(IgniteServerImpl.java:418)
at org.apache.ignite.IgniteServer.start(IgniteServer.java:77)

how can I use apache Ignite 3 embedded mode?

thanks.


Solution

  • Most likely, JVM parameters are missing:

    --add-opens java.base/java.lang=ALL-UNNAMED
    --add-opens java.base/java.lang.invoke=ALL-UNNAMED
    --add-opens java.base/java.lang.reflect=ALL-UNNAMED
    --add-opens java.base/java.io=ALL-UNNAMED
    --add-opens java.base/java.nio=ALL-UNNAMED
    --add-opens java.base/java.math=ALL-UNNAMED
    --add-opens java.base/java.util=ALL-UNNAMED
    --add-opens java.base/java.time=ALL-UNNAMED
    --add-opens java.base/jdk.internal.misc=ALL-UNNAMED
    --add-opens java.base/jdk.internal.access=ALL-UNNAMED
    --add-opens java.base/sun.nio.ch=ALL-UNNAMED
    -Dio.netty.tryReflectionSetAccessible=true
    

    https://ignite.apache.org/docs/ignite3/latest/quick-start/embedded-mode#pass-jvm-parameters