6

I am new to Neo4J and trying to connect to Neo4J server through java.

My pom entries of a standalone project are as follows:

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

This project is in classpath of a java EE project and that is deployed as war on tomcat.

My code is trying to open a session as follows:

Configuration configuration = Components.configuration();
        configuration.driverConfiguration()
                     .setDriverClassName("org.neo4j.ogm.drivers.http.driver.HttpDriver")
                     .setURI("http://localhost:7474")
                     .setCredentials("xxxx", "xxxx");
SessionFactory sessionFactory = new SessionFactory("com.myapp.infra.transaction");
sessionFactory.openSession();

Last line is throwing following error:

org.neo4j.ogm.exception.ServiceNotFoundException: Driver:
org.neo4j.ogm.drivers.http.driver.HttpDriver
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)

Am not using Spring and code is using JDK 7. Any help will be really useful.

Thanks! :)

Amit Pamecha
  • 119
  • 5

1 Answers1

0

Please use Configuration config = new Configuration();

An existing configuration should not be reconfigured. The Components.configuration() method should have been removed in 2.0.1 but it was overlooked. The method has been deprecated and will be removed in the next release.

We'll be updating the documentation on this as soon as possible. Sorry for any confusion.

Vince
  • 2,181
  • 13
  • 16
  • Thanks Vince.. I changed my code but still getting same error... Modified code looks like: Configuration client = new Configuration(); client.driverConfiguration() .setDriverClassName("org.neo4j.ogm.drivers.http.driver.HttpDriver") .setURI("http://localhost:7474") .setCredentials("xxxx", "xxxx"); sessionFactory = new SessionFactory(client,"com.myapp.infra.transaction"); Also tried this, it was working fine http://inner-loop.github.io/java-neo4j-ogm/ – Amit Pamecha Apr 19 '16 at 18:08