2015-08-24 8 views
0

J'essaie d'utiliser Neo4J OGM 1.1.1 avec Play 2 Java framework 2.4.2. mais, je vois ClassNotFoundException quand j'exécute l'application. Ci-dessous est ma classe usine de session:[RuntimeException: java.lang.ClassNotFoundException:]: avec Neo4J OGM utilisant avec Play framework 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"); 
    } 
} 

classe 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; 
    } 
} 

Détails de l'exception peuvent être trouvées @https://github.com/neo4j/neo4j-ogm/issues/34

Répondre