0
我开始学习neo4j DB。我的测试代码如下:无法实例化neo4j
@Test
public void persistedMovieShouldBeRetrievableFromGraphDb() {
GraphDatabaseService graphDB = new EmbeddedGraphDatabase("data/graph.db");
registerShutdownHook(graphDB);
Transaction tx = graphDB.beginTx();
try{
Neo4jTemplate template = new Neo4jTemplate(graphDB);
Movie forrestGump = template.save(new Movie("Forrest Gump", 1994));
Movie retrievedMovie = template.findOne(forrestGump.getId(), Movie.class);
assertEquals("Retrieved Movie matched persisted one", forrestGump, retrievedMovie);
assertEquals("retrieved movie title matches", "Forrest Gump", retrievedMovie.getTitle());
}
finally{
tx.finish();
}
}
然而,它总是给一个例外:
java.lang.NoSuchMethodError: org.neo4j.kernel.impl.transaction.SpringTransactionManager.<init>(Lorg/neo4j/kernel/GraphDatabaseAPI;)V
我见过这个问题。在你的'pom.xml'你有neo4j声明和spring-data-neo4j,对吗? – Nicholas 2012-07-11 20:03:49
@Nicholas我没有pom.xml。我正在手动管理我的JAR。 – Batman 2012-07-22 18:27:02
那么你能告诉我们你有哪些JAR的spring-data-neo4j和neo4j-kernel? – Nicholas 2012-07-23 23:09:40