spring boot 集成 Neo4j org.neo4j.ogm.metadata.DomainInfo.useClassgraph(DomainInfo.java:128)

发布时间 2023-06-07 08:57:38作者: 雁书几封

spring boot 版本:2.2.13.RELEASE

 

问题在于 引入后 ,报错

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

 

 

***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

    org.neo4j.ogm.metadata.DomainInfo.useClassgraph(DomainInfo.java:128)

The following method did not exist:

    io.github.classgraph.ClassGraph.acceptPackages([Ljava/lang/String;)Lio/github/classgraph/ClassGraph;

The method's class, io.github.classgraph.ClassGraph, is available from the following locations:

    jar:file:/D:/Java_Soft/Apache/apache-maven/repository/io/github/classgraph/classgraph/4.8.83/classgraph-4.8.83.jar!/io/github/classgraph/ClassGraph.class

It was loaded from the following location:

    file:/D:/Java_Soft/Apache/apache-maven/repository/io/github/classgraph/classgraph/4.8.83/classgraph-4.8.83.jar


Action:

Correct the classpath of your application so that it contains a single, compatible version of io.github.classgraph.ClassGraph

Disconnected from the target VM, address: '127.0.0.1:59632', transport: 'socket'

Process finished with exit code 1

 

进入类后发现问题,估计是jar冲突导致,解决方案,单独引入这个,暂时解决报错问题

 

 

 

解决方案,多引入 第二个 org.neo4j 

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