2015-08-24 33 views
0

我想用Play 2 Java框架2.4.2 Neo4J OGM 1.1.1。但是,我在运行应用程序时看到了ClassNotFoundException。 下面是我的会话工厂类:[RuntimeException:java.lang.ClassNotFoundException:]:与Neo4J OGM使用与Play框架Java 2.4.2

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类

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

回答