cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Issue with using neo4j OGM embedded driver

I am having issues using the embedded driver with neo4j OGM for testing. I set up my SessionFactory like this:
3X_2_9_29dc72b04e03b35a116f56b0eeeaeb535d09047d.png

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.

1 REPLY 1

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.