Neo4j问题汇总

Win10 Neo4j问题汇总

  • 1. Neo4j start失败问题
    • 1.1 问题表现
    • 1.2 解决方法
    • 1.3 问题原因
  • 2. neo4j-import csv时,源数据存在换行问题
    • 2.1 问题描述
    • 2.2 解决方法

1. Neo4j start失败问题

1.1 问题表现

主要是在PowerShell中输入neo4j start之后系统提示neo4j started,访问http://localhost:7474/browser/时提示连接不上。
然后查看任务管理器中发现Neo4j服务被强停,重新打开之后依旧被自动停止。
在PowerShell中输入neo4j.bat console发现了如下错误:

INFO  ======== Neo4j 3.5.7 ========
INFO  Starting...
ERROR Failed to start Neo4j: Starting Neo4j failed: Component 'org.neo4j.server.database.LifecycleManagingDatabase@15723761' was successfully initialized, but failed to start. Please see the attached cause exception "apoc/scoring/Scoring has been compiled
by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0". Starting Neo4j failed: Component 'org.neo4j.server.database.LifecycleManagingDatabase@15723761' was successfully initialized, but failed to start. Please see the attached cause exception "apoc/scoring/Scoring has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0".
org.neo4j.server.ServerStartupException: Starting Neo4j failed: Component 'org.neo4j.server.database.LifecycleManagingDatabase@15723761' was successfully initialized, but failed to start. Please see the attached cause exception "apoc/scoring/Scoring has been compiled by a more recent
version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0".
  at org.neo4j.server.exception.ServerStartupErrors.translateToServerStartupError(ServerStartupErrors.java:45)
  at org.neo4j.server.AbstractNeoServer.start(AbstractNeoServer.java:187)
  at org.neo4j.server.ServerBootstrapper.start(ServerBootstrapper.java:124)
  at org.neo4j.server.ServerBootstrapper.start(ServerBootstrapper.java:91)
  at org.neo4j.server.CommunityEntryPoint.main(CommunityEntryPoint.java:32)
Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.server.database.LifecycleManagingDatabase@15723761' was successfully initialized, but failed to start. Please see the attached cause exception "apoc/scoring/Scoring has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0".
  at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:473)        at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:111)
  at org.neo4j.server.AbstractNeoServer.start(AbstractNeoServer.java:180)
  ... 3 more
Caused by: java.lang.RuntimeException: Error starting org.neo4j.graphdb.facade.GraphDatabaseFacadeFactory, D:\Neo4J\neo4j-community-3.5.7\data\databases
  at org.neo4j.graphdb.facade.GraphDatabaseFacadeFactory.initFacade(GraphDatabaseFacadeFactory.java:230)
  at org.neo4j.graphdb.facade.GraphDatabaseFacadeFactory.newFacade(GraphDatabaseFacadeFactory.java:146)
  at org.neo4j.server.database.CommunityGraphFactory.newGraphDatabase(CommunityGraphFactory.java:41)
  at org.neo4j.server.database.LifecycleManagingDatabase.start(LifecycleManagingDatabase.java:90)
  at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:452)        ... 5 more
Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.kernel.impl.proc.Procedures@31ff1390' was successfully initialized, but failed to start. Please see the attached cause exception "apoc/scoring/Scoring has been compiled by a more recent version of the Java
Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file
versions up to 52.0".
  at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:473)        at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:111)
  at org.neo4j.graphdb.facade.GraphDatabaseFacadeFactory.initFacade(GraphDatabaseFacadeFactory.java:225)
Caused by: java.lang.UnsupportedClassVersionError: apoc/scoring/Scoring has been compiled by a
time only recognizes class file versions up to 52.0
  at java.lang.ClassLoader.defineClass1(Native Method)
  at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
  at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
  at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
  at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
  at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
  at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:411)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
  at org.neo4j.kernel.impl.proc.ProcedureJarLoader$1.fetchNextOrNull(ProcedureJarLoader.java:161)
  at org.neo4j.kernel.impl.proc.ProcedureJarLoader$1.fetchNextOrNull(ProcedureJarLoader.java:138)
  at org.neo4j.collection.PrefetchingRawIterator.peek(PrefetchingRawIterator.java:50)
  at org.neo4j.collection.PrefetchingRawIterator.hasNext(PrefetchingRawIterator.java:36)
  at org.neo4j.kernel.impl.proc.ProcedureJarLoader.loadProcedures(ProcedureJarLoader.java:111)
  at org.neo4j.kernel.impl.proc.ProcedureJarLoader.loadProceduresFromDir(ProcedureJarLoader.java:85)
  at org.neo4j.kernel.impl.proc.Procedures.start(Procedures.java:323)
  at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:452)        ... 11 more
INFO  Neo4j Server shutdown initiated by request

1.2 解决方法

将$NEO4J_HOME/plugins中的APOC插件降低版本。

1.3 问题原因

原因显而易见,错误中提示:

Please see the attached cause exception "apoc/scoring/Scoring has been compiled by a more recent
version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0"

我用的APOC插件是被高版本Java(55.0)编译出来的,而当前Java最多只支持到52.0,所以需要降低APOC的版本,需要的可以从neo4j-contrib/neo4j-apoc-procedures中下载对应的版本。

这个问题正如Neo4j社区这篇帖子dana.canzano所讲,this may be due to a invalid APOC version in $NEO4J_HOME/plugins.

我刚开始没有看错误提示就Google的时候也发现了其他对类似问题的描述。

方法一:这里面主要针对的是**Component **** was successfully initialized, but failed to start.**描述的问题,Neo4j已经成功初始化,但是在启动失败。可能是neo4j自身的bug?只允许在本机中运行一个数据库。有待进一步了解。解决方法按照这篇博客评论区的方法,把%NEO4J_HOME%\data\databases里面的所有文件都删除掉,然后再运行即可。
方法二解决的问题:neo4j的Github issue中描述的那样,APOC 使用Neo4j内部内核扩展 API。假定这种扩展对数据库的安全和正确操作至关重要,就会因为加载而提示失败。可能后面使用APOC操作时会碰到。

2. neo4j-import csv时,源数据存在换行问题

2.1 问题描述

使用neo4j-import导入数据时提示:

Multi-line fields are illegal in this context and so this might suggest that there’s a field with a start quote, but a missing end quote.

2.2 解决方法

将命令修改为

neo4j-admin import --multiline-fields=true --nodes entity.csv  --relationships relationship.csv

你可能感兴趣的:(知识图谱)