neo4j-ogm 2.0配置错误驱动程序null

时间:2016-04-23 02:41:53

标签: neo4j neo4j-ogm

我设置了我的neo4j,但它得到了导出错误

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 个答案:

答案 0 :(得分: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();