Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
03-29-2022 08:50 AM
I am having issues using the embedded driver with neo4j OGM for testing. I set up my SessionFactory like this:
but when I run my tests I get this error:
java.lang.NoClassDefFoundError: org/neo4j/graphdb/factory/GraphDatabaseFactory
at org.neo4j.ogm.drivers.embedded.driver.EmbeddedDriver.getGraphDatabaseFactory(EmbeddedDriver.java:143)
at org.neo4j.ogm.drivers.embedded.driver.EmbeddedDriver.configure(EmbeddedDriver.java:116)
at org.neo4j.ogm.session.SessionFactory.newConfiguredDriverInstance(SessionFactory.java:268)
at org.neo4j.ogm.session.SessionFactory.(SessionFactory.java:89)
I am using neo4j OGM version 3.2.32 and neo4j version 4.1.0, the strange thing is if I revert my neo4j version to 3.5 it works fine. Here is my pom just for reference:
I would like to use neo4j version 4.1 and the documentation says that neo4j OGM should support up to 4.1: Reference - OGM Library
If anyone has any ideas on how to fix it it would be greatly appreciated. Thanks.
03-30-2022 12:14 AM
Please read the linked compatibility matrix carefully. It points out:
2 These versions are only supported over Bolt.
Meaning that you have to pull in the 4.x dependencies manually (without depending on Neo4j-OGM's embedded driver) and start the embedded instance with Bolt enabled. Your connection should then be also based on Bolt.
As an alternative solution, you could also go with the Neo4j Testcontainers and connect to it as it where just another server. It is most of the time the better alternative than creating a local stack for testing manually.
All the sessions of the conference are now available online