neo4j-gremlin not working with JDK17
Neo4jGraph
fails to start with top-level error like:
Error starting org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactorywith causes like:
Suppressed: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.kernel.impl.scheduler.CentralJobScheduler@5906ebfb' failed to transition from stopped to shutting_down. Please see the attached cause exception "Exception java.lang.LinkageError: Could not get Throwable message field [in thread "main"]"and:
Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.kernel.NeoStoreDataSource@4bfe83d' was successfully initialized, but failed to start. Please see the attached cause exception "Exception java.lang.IllegalAccessError: class org.neo4j.io.pagecache.impl.SingleFilePageSwapper (in unnamed module @0x75eeccf5) cannot access class sun.nio.ch.FileChannelImpl (in module java.base) because module java.base does not export sun.nio.ch to unnamed module @0x75eeccf5 [in thread "main"]".
Solution:Jump to solution
This issue relates back to: https://tinkerpop.apache.org/docs/current/upgrade/#_building_and_running_with_jdk_17 and the need to add this JVM option:
--add-opens=java.base/sun.nio.ch=ALL-UNNAMED...
4 Replies
Solution
This issue relates back to: https://tinkerpop.apache.org/docs/current/upgrade/#_building_and_running_with_jdk_17 and the need to add this JVM option:
--add-opens=java.base/sun.nio.ch=ALL-UNNAMED
should be made easier in Gremlin Console usage of Neo4j with: https://github.com/apache/tinkerpop/commit/4d9347088d0ec0e5f5d87ab78358d687620ca4d5 which detects JDK17 and inserts the flag.
Which specific JDK versions can run the Gremlin console / server builds? I'm having
Unsupported class file major version X
errors (even on the latest 4.0.0 Snapshot) trying to run the console from the beginning. It looks like JDK 22 is not having it. (File version 66 for some reason).we only build to jdk17 (though 11/8) should still work