Spring boot integration test fails with Neo4j

懵懂的女人 提交于 2019-12-08 19:54:30

Seems like you're missing a dependency on the embedded driver. If you add the following to your POM does it work?

    <dependency>
        <groupId>org.neo4j</groupId>
        <artifactId>neo4j-ogm-embedded-driver</artifactId>
        <version>${neo4j-ogm.version}</version>
        <scope>test</scope>
    </dependency>

A shortcut to get a valid setup is to install neo4j locally and check the /lib directory to find a good match between the version of neo4j and jetty-server

I got the same error running the "vanilla" installation of spring-data-neo4j. According to the default installation of neo4j I could spot the following compatible versions:

  • neo4j-* version 3.1.2
  • org.eclipse.jetty.* version 2.9.2 - spring insists me to use 2.3.*

Spring-boot wants me to run jetty-* 2.3.* which the SessionManager was removed by some reason.

Spring Boot's default version of Jetty is newer and incompatible with the version required by Neo4j's embedded Jetty server. You can workaround the issue by forcing the version of Jetty used by Spring Boot. To do this with Gradle you specify the following in build.gradle:

ext['jetty.version'] = '9.2.9.v20150224'

For Maven I imagine it would be:

<jetty.version>9.2.9.v20150224</jetty.version>

Note that 9.2.9.v20150224 should be replaced with whatever transitive version of Jetty is required by the version of Neo4j you are using.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!