Search code examples
springspring-bootneo4jpom.xmlspring-data-neo4j

Spring Boot Neo4j Could not open Neo4j Session for transaction


I have an application that communicates with neo4j This my pom.xml

`

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-neo4j</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-rest</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <version>1.18.6</version>
        <scope>provided</scope>
    </dependency>

</dependencies>`

When I start my app, I get this error:

Error creating bean with name 'botMessageController' defined in file [C:\Users\Davit.gevorgyan\IdeaProjects\cc-root\cc-admin-backend\target\classes\vga\j\cc\admin\backend\rest\BotMessageController.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'botMessageService': Invocation of init method failed; nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open Neo4j Session for transaction; nested exception is org.neo4j.ogm.exception.ConnectionException: Could not create driver instance

Please help solve this problem.

I try add dependecies like this, but problem is already exist

Direct driver instance 70543368 created for server address localhost:7687 Closing connection pool towards localhost:7687 -

    `<dependency>
        <groupId>org.neo4j</groupId>
        <artifactId>neo4j</artifactId>
        <version>3.4.9</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.neo4j</groupId>
        <artifactId>neo4j-ogm-embedded-driver</artifactId>
        <version>3.1.8</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.neo4j</groupId>
        <artifactId>neo4j-ogm-bolt-driver</artifactId>
        <version>3.1.8</version>
    </dependency>`

How can I solve this problem...?


Solution

  • I changed Neo4j version to 3.4.5, and then start working. Because java 1.8 compatible only Neo4j 3x versions.

    https://neo4j.com/download/neo4j-desktop/?edition=desktop&flavour=winstall64&release=1.3.7&offline=true - Neo4j old version with 3x support