1

我正在编写一个 Neo4j 插件,我想在其中使用 elasticsearch。在运行 neo4j 时,出现以下错误:

ERROR Failed to start Neo4j: Starting Neo4j failed: Component 'org.neo4j.server.database.LifecycleManagingDatabase@435a13ac' was successfully initialized, but failed to start. Please see the attached cause exception "org.apache.log4j.Logger". Starting Neo4j failed: Component 'org.neo4j.server.database.LifecycleManagingDatabase@435a13ac' was successfully initialized, but failed to start. Please see the attached cause exception "org.apache.log4j.Logger".
org.neo4j.server.ServerStartupException: Starting Neo4j failed: Component 'org.neo4j.server.database.LifecycleManagingDatabase@435a13ac' was successfully initialized, but failed to start. Please see the attached cause exception "org.apache.log4j.Logger".
    at org.neo4j.server.exception.ServerStartupErrors.translateToServerStartupError(ServerStartupErrors.java:68)
    at org.neo4j.server.AbstractNeoServer.start(AbstractNeoServer.java:219)
    at org.neo4j.server.ServerBootstrapper.start(ServerBootstrapper.java:111)
    at org.neo4j.server.ServerBootstrapper.start(ServerBootstrapper.java:79)
    at org.neo4j.server.CommunityEntryPoint.main(CommunityEntryPoint.java:32)
Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.server.database.LifecycleManagingDatabase@435a13ac' was successfully initialized, but failed to start. Please see the attached cause exception "org.apache.log4j.Logger".
    at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:466)
    at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:107)
    at org.neo4j.server.AbstractNeoServer.start(AbstractNeoServer.java:211)
    ... 3 more
Caused by: java.lang.RuntimeException: Error starting org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory, /home/gaurav_verma/.ineo/instances/staging2/data/databases/graph.db
    at org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory.initFacade(GraphDatabaseFacadeFactory.java:211)
    at org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory.newFacade(GraphDatabaseFacadeFactory.java:126)
    at org.neo4j.server.CommunityNeoServer.lambda$static$0(CommunityNeoServer.java:58)
    at org.neo4j.server.database.LifecycleManagingDatabase.start(LifecycleManagingDatabase.java:88)
    at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:445)
    ... 5 more
Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.kernel.impl.proc.Procedures@72c8de78' was successfully initialized, but failed to start. Please see the attached cause exception "org.apache.log4j.Logger".
    at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:466)
    at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:107)
    at org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory.initFacade(GraphDatabaseFacadeFactory.java:207)
    ... 9 more
Caused by: java.lang.NoClassDefFoundError: Lorg/apache/log4j/Logger;
    at java.lang.Class.getDeclaredFields0(Native Method)
    at java.lang.Class.privateGetDeclaredFields(Class.java:2583)
    at java.lang.Class.getDeclaredFields(Class.java:1916)
    at org.neo4j.kernel.impl.proc.FieldInjections.setters(FieldInjections.java:90)
    at org.neo4j.kernel.impl.proc.ReflectiveProcedureCompiler.compileFunction(ReflectiveProcedureCompiler.java:318)
    at org.neo4j.kernel.impl.proc.ReflectiveProcedureCompiler.compileFunction(ReflectiveProcedureCompiler.java:119)
    at org.neo4j.kernel.impl.proc.ProcedureJarLoader.loadProcedures(ProcedureJarLoader.java:95)
    at org.neo4j.kernel.impl.proc.ProcedureJarLoader.loadProceduresFromDir(ProcedureJarLoader.java:82)
    at org.neo4j.kernel.impl.proc.Procedures.start(Procedures.java:275)
    at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:445)
    ... 11 more
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 21 more

以下是我的 pom 条目:

<dependency>
     <groupId>org.elasticsearch.client</groupId>
     <artifactId>transport</artifactId>
     <version>6.2.4</version>
</dependency>

<dependency>
     <groupId>log4j</groupId>
     <artifactId>log4j</artifactId>
     <version>1.2.17</version>
</dependency>

我也尝试过使用 log4j-core 和 log4j-api pom 条目,但仍然遇到相同的错误。我还看到了依赖树,发现了 commons-logging:commons-logging:jar 的两个冲突版本,但我不知道如何解决这个问题。

谁能告诉我是什么问题以及如何解决这个问题。

4

1 回答 1

0

请尝试使用此依赖项:

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

通常,您可以通过在search.maven.org上搜索完整的类名来解决此类异常。

于 2018-05-23T09:12:48.397 回答