2016-04-23 65 views
1

我已經把我的Neo4j,但它得到推導器錯誤的Neo4j-OGM 2.0配置錯誤的驅動程序無效

Configuration cfg = Components.configuration(); 
    cfg.driverConfiguration() 
     .setDriverClassName("org.neo4j.ogm.drivers.http.driver.HttpDriver") 
     .setURI("http://localhost:7474") 
     .setCredentials("neo4j","neo4j"); 
    SessionFactory sessionFactory = new SessionFactory(cfg,"rdf2rdf.domain"); 
    //Session session = Neo4jSessionFactory.getInstance().getNeo4jSession(); 
    Session session = sessionFactory.openSession(); 

,但它得到一個錯誤!

Exception in thread "main" org.neo4j.ogm.exception.ServiceNotFoundException: Driver: null 
at org.neo4j.ogm.service.DriverService.load(DriverService.java:51) 
at org.neo4j.ogm.service.DriverService.load(DriverService.java:63) 
at org.neo4j.ogm.service.Components.loadDriver(Components.java:126) 
at org.neo4j.ogm.service.Components.driver(Components.java:84) 
at org.neo4j.ogm.session.SessionFactory.openSession(SessionFactory.java:79) 
at rdf2rule.rdf2rule.App.main(App.java:48) 

看來我的sessionfacotry是錯的!誰能幫我?請。

回答

1

你需要include the http driver

<dependency> 
    <groupId>org.neo4j</groupId> 
    <artifactId>neo4j-ogm-http-driver</artifactId> 
    <version>2.0.1</version> 
</dependency> 

另外,請更改 Configuration cfg = Components.configuration();

Configuration cfg = new Configuration();

+0

的感謝!有用。但我仍然想知道Components.configuration()和Configuration()之間的區別 – shell

+0

ogm文檔不正確。當建立一個新的配置時,你總是需要實例化一個新的配置,而不是重用。我們將在下一個版本中刪除其他方法 – Luanne

相關問題