Search code examples
neo4jdriversneo4j-ogm

Neo4J OGM Java connection establishment issues


I am using Neo4J 3.2.0 community edition and I was able to connect and establish connection properly using traditional java driver and running Cypher queries.

However, I wanted to create rich data model, so I imported the following dependencies:

<dependency>
    <groupId>org.neo4j</groupId>
    <artifactId>neo4j-ogm-core</artifactId>
    <version>2.1.3</version>
</dependency>
<dependency>
    <groupId>org.neo4j</groupId>
    <artifactId>neo4j-ogm-bolt-driver</artifactId>
    <version>2.1.3</version>
</dependency>

Post that, I wrote the following code to establish the connection:

Configuration configuration = new Configuration();
configuration.driverConfiguration().setDriverClassName("org.neo4j.ogm.drivers.bolt.driver.BoltDriver")
        .setURI("bolt://localhost:7687");

SessionFactory sessionFactory = new SessionFactory(configuration, "org.neo4j.example.domain");
Session session = sessionFactory.openSession();

But irrespective of weather my Neo4j server is turned on or not, it establish connection, and the logs dont show any errors, just the following three lines for the logging system:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

Any help would be appreciated.


Solution

  • Adding the following dependency fixes it:

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>1.7.25</version>
        </dependency>