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