SDN4:最近的快照构建损坏

SDN4: Recent snapshot build broken

刚开始在启动服务器时遇到以下异常:

Error creating bean with name 'myRepository': Invocation of init method failed;  nested exception is java.lang.NoClassDefFoundError: org/springframework/data/mapping/context/InvalidPersistentPropertyPath: org.springframework.data.mapping.context.InvalidPersistentPropertyPath

哪些更改可能导致此异常?

谢谢。

我正在使用 Gradle 并且遇到了完全相同的问题。

InvalidPersistentPropertyPath 似乎已在 spring-data-commons 的最新 SNAPSHOT 版本中引入(1.11.0.BUILD-SNAPSHOT)。我的项目还包括 Spring Data JPA,它依赖于更稳定的版本 (1.11.0.M1)。 Gradle 解决了一些冲突并使用了 M1 库,它没有新的 class 并导致了 NoClassDefFoundError

现在,我通过告诉 Gradle 忽略 spring-data-commons 作为 JPA 的传递依赖项来解决这个问题,以便使用作为 SDN 的传递依赖项引入的 SNAPSHOT 构建:

compile("org.springframework.data:spring-data-jpa:$springDataJpaVersion") {
  exclude group: "org.springframework.data", module: "spring-data-commons"
}

如果您使用的是 Gradle,您可以使用以下方法检查冲突:

./gradlew <project>:dependencies

我认为值得检查每个项目的发布时间表,但这种变通办法不允许我们继续构建。

我正在使用 Maven,Spring Boot 1.3.0.M1,spring-data-neo4j 4.0.0.BUILD-SNAPSHOT 和 neo4j 2.2.2.

正如 simonl 建议的那样,用 1.11 覆盖 spring-data-commons 1.11.0.M1。0.BUILD-SNAPSHOT 解决了这个问题。

<!-- Fix ClassNotFoundException: org.springframework.data.mapping.PersistentPropertyAccessor -->
<dependency>
    <groupId>org.springframework.data</groupId>
    <artifactId>spring-data-commons</artifactId>
    <version>1.11.0.BUILD-SNAPSHOT</version>
</dependency>

我记得过去在使用带有 SDN 3 的较新版本的 Neo4j 时必须这样做,但直到现在才需要用 SDN 4 覆盖 spring-data-commons。