Neo4j 3.0.1引起:java.lang.ClassNotFoundException:org.neo4j.ogm.result.ResultAdapter

时间:2016-05-24 10:51:48

标签: neo4j spring-data-neo4j spring-data-neo4j-4

我正在尝试将我的项目从SDN Neo4j 3移至SDN Neo4j 4和Neo4j 3.0.1。

现在我失败并出现以下异常:

java.lang.NoClassDefFoundError: org/neo4j/ogm/result/ResultAdapter
    at org.neo4j.ogm.drivers.embedded.request.EmbeddedRequest.execute(EmbeddedRequest.java:69)
    at org.neo4j.ogm.session.delegates.ExecuteQueriesDelegate.executeAndMap(ExecuteQueriesDelegate.java:110)
....
Caused by: java.lang.ClassNotFoundException: org.neo4j.ogm.result.ResultAdapter
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 92 more

在我的Maven pom中,我有以下依赖关系:

<dependency>
    <groupId>org.neo4j</groupId>
    <artifactId>neo4j-ogm-api</artifactId>
    <version>2.0.2</version>
</dependency>
<dependency>
    <groupId>org.neo4j</groupId>
    <artifactId>neo4j-ogm-drivers</artifactId>
    <version>2.0.0-M02</version>
</dependency>
<dependency>
    <groupId>org.neo4j</groupId>
    <artifactId>neo4j-enterprise</artifactId>
    <version>3.0.1</version>
</dependency>
<dependency>
    <groupId>org.neo4j</groupId>
    <artifactId>neo4j</artifactId>
    <version>3.0.1</version>
</dependency>
<dependency>
    <groupId>org.neo4j</groupId>
    <artifactId>neo4j-kernel</artifactId>
    <version>3.0.1</version>
</dependency>


<dependency>
    <groupId>org.springframework.data</groupId>
    <artifactId>spring-data-neo4j</artifactId>
    <version>4.1.1.RELEASE</version>
</dependency>

如何解决此问题?

1 个答案:

答案 0 :(得分:0)

保持neo4j-ogm-api和neo4j-ogm-drivers的依赖版本同步:

<dependency>
  <groupId>org.neo4j</groupId>
  <artifactId>neo4j-ogm-drivers</artifactId>
  <version>2.0.0-M2</version> <!-- this should be 2.0.2 -->
</dependency>