[RuntimeException: java.lang.ClassNotFoundException:]: Neo4J OGM 使用 Play 框架 Java 2.4.2

[RuntimeException: java.lang.ClassNotFoundException:]: with Neo4J OGM using with Play framework Java 2.4.2

我正在尝试将 Neo4J OGM 1.1.1 与 Play 2 Java 框架 2.4.2 一起使用。但是,当我 运行 应用程序时,我看到了 ClassNotFoundException。 下面是我的会话工厂 class:

package org.neo;

import org.neo4j.ogm.session.Session;
import org.neo4j.ogm.session.SessionFactory;

public class Neo4jSessionFactory {


    private static SessionFactory sessionFactory = new SessionFactory("org.neo.models");
    private static Neo4jSessionFactory factory = new Neo4jSessionFactory();

    public static Neo4jSessionFactory getInstance() {
        return factory;
    }

    private Neo4jSessionFactory() {

        System.setProperty("username", "neo4j");
        System.setProperty("password", "neo");
    }

    public Session getNeo4jSession() {
        return sessionFactory.openSession("http://localhost:7474");
    }
}

org.neo.models.School class

package org.neo.models;

import org.neo4j.ogm.annotation.NodeEntity;
import org.neo4j.ogm.annotation.Relationship;

import java.util.HashSet;
import java.util.Set;

@NodeEntity(label = "School")
public class School extends Entity {

    String name;

    @Relationship(type = "DEPARTMENT")
    Set<Department> departments;

    @Relationship(type = "STAFF")
    Set<Teacher> teachers;

    @Relationship(type = "HEAD_TEACHER")
    Teacher headTeacher;

    @Relationship(type = "STUDENT")
    Set<Student> students;

    public School() {
        this.departments = new HashSet<>();
        this.teachers = new HashSet<>();
        this.students = new HashSet<>();
    }

    public School(String name) {
        this();
        this.name = name;
    }

    @Override
    public String toString() {
        return "School{" +
                "id=" + getId() +
                ", name='" + name + '\'' +
                ", departments=" + departments.size() +
                ", teachers=" + teachers.size() +
                ", students=" + students.size() +
                '}';
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Set<Department> getDepartments() {
        return departments;
    }

    public void setDepartments(Set<Department> departments) {
        this.departments = departments;
    }

    public Set<Teacher> getTeachers() {
        return teachers;
    }

    public void setTeachers(Set<Teacher> teachers) {
        this.teachers = teachers;
    }

    public Teacher getHeadTeacher() {
        return headTeacher;
    }

    public void setHeadTeacher(Teacher headTeacher) {
        this.headTeacher = headTeacher;
    }

    public Set<Student> getStudents() {
        return students;
    }

    public void setStudents(Set<Student> students) {
        this.students = students;
    }
}

可以在@https://github.com/neo4j/neo4j-ogm/issues/34

中找到异常详细信息

问题已解决,需要在 neo4j-ogm 中进行额外的工作。

参见:https://github.com/neo4j/neo4j-ogm/issues/34