Neo4j error 笔记

把使用neo4j时遇到的一些常见的问题、错误分享给大家
这要包括 启动问题、前端问题、导入数据问题、工程问题、部署问题,欢迎大家补充。

(1) 启动问题

(1.1) Neo4j启动没反应但也不报错

在服务器上用neo4j start启动neo4j,没有任何反应,用neo4j console启动也没反应
JDK的问题,换成Oracle JDK-1.8,不要用Open JDK

(1.2) org.neo4j.server.database.LifecycleManagingDatabase was successfully initialized, but failed to start

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
警告: This command does not appear to be running with administrative
rights. Some commands may fail e.g. Start/Stop
2017-03-23 03:01:33.868+0000 INFO Starting...
2017-03-23 03:01:34.729+0000 INFO Bolt enabled on 0.0.0.0:7687.
2017-03-23 03:01:34.838+0000 ERROR Failed to start Neo4j: Starting Neo4j failed: Component 'org.neo4j.server.database.LifecycleManagingDatabase@5dc1b1c4' was successfully initialized, but failed to start. Please see attached cause exception. Starting Neo4j failed: Component 'org.neo4j.server.database.LifecycleManagingDatabase@5dc1b1c4' was successfully initialized, but failed to start. Please seeattached cause exception.
org.neo4j.server.ServerStartupException: Starting Neo4j failed: Component 'org.neo4j.server.database.LifecycleManagingDatabase@5dc1b1c4' was successfully initialized, but failed to start. Please see attached cause exception.

Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.server.database.LifecycleManagingDatabase@5dc1b1c4' was successfully initialized, but failed to start. Please see attached cause exception.

Caused by: java.lang.RuntimeException: Error starting org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory, C:\ProfessionSofware\Neo4j\neo4j-community-3.1.2\C:ProfessionSofwareNeo4j\databases\charles.graph.db

Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.kernel.internal.StoreLockerLifecycleAdapter@3edf2098' was successfully initialized, but failed to start. Please see attached cause exception.

Caused by: org.neo4j.kernel.StoreLockException: Unable to create path for store dir: C:\ProfessionSofware\Neo4j\neo4j-community-3.1.2\C:ProfessionSofwareNeo4j\databases\charles.graph.db. Please ensureno other process is using this database, and that the directory is writable (required even for read-only access)
at org.neo4j.kernel.internal.StoreLocker.storeLockException(StoreLocker.java:94)

Caused by: java.io.IOException: Unable to create directory path [C:\ProfessionSofware\Neo4j\neo4j-community-3.1.2\C:ProfessionSofwareNeo4j\databases\charles.graph.db] for Neo4j store.
at org.neo4j.io.fs.DefaultFileSystemAbstraction.mkdirs(DefaultFileSystemAbstraction.java:113)
at org.neo4j.kernel.internal.StoreLocker.checkLock(StoreLocker.java:64)

Unable to create path for store dir, 没有写权限
遇到这个问题,一般都是和路径或者权限有关

最后发现原因是配置文件里dbms.directories.data路径写错了

(1.3) TLS private key found, but missing certificate

1
2
3
4
5
6
7
8
9
10
11
12
13
C:\ProfessionSofware\Neo4j\neo4j-community-3.1.2\bin>neo4j console
警告: This command does not appear to be running with administrative rights. Some
commands may fail e.g. Start/Stop
2017-04-24 07:06:54.426+0000 ERROR Failed to start Neo4j: TLS private key found, but missing certificate at 'C:\ProfessionSofware\Neo4j\neo4j-community-3.1.2\certificates\neo4j.cert'. Cannot start ser
ver without certificate. TLS private key found, but missing certificate at 'C:\ProfessionSofware\Neo4j\neo4j-community-3.1.2\certificates\neo4j.cert'. Cannot start server without certificate.
org.neo4j.server.ServerStartupException: TLS private key found, but missing certificate at 'C:\ProfessionSofware\Neo4j\neo4j-community-3.1.2\certificates\neo4j.cert'. Cannot start server without certi
ficate.
at org.neo4j.server.AbstractNeoServer.createKeyStore(AbstractNeoServer.java:387)
at org.neo4j.server.AbstractNeoServer.init(AbstractNeoServer.java:183)
at org.neo4j.server.AbstractNeoServer.start(AbstractNeoServer.java:196)
at org.neo4j.server.ServerBootstrapper.start(ServerBootstrapper.java:91)
at org.neo4j.server.ServerBootstrapper.start(ServerBootstrapper.java:68)
at org.neo4j.server.CommunityEntryPoint.main(CommunityEntryPoint.java:28)

有neo4j.key但是没有neo4j.cert文件,刚才把neo4j.cert误删了

(1.4) /browser/scripts/8eea4b31.components.js org.eclipse.jetty.util.SharedBlockingCallback$BlockerTimeoutException

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
[admin@user01 neo4j-community-3.1.3]$ ./bin/neo4j console
Starting Neo4j.
WARNING: Max 1024 open files allowed, minimum of 40000 recommended. See the Neo4j manual.
2017-05-03 12:00:12.496+0000 INFO ======== Neo4j 3.1.3 ========
2017-05-03 12:00:12.880+0000 INFO Starting...
2017-05-03 12:00:13.825+0000 INFO Bolt enabled on 0.0.0.0:7687.
2017-05-03 12:00:19.550+0000 INFO Started.
2017-05-03 12:00:20.975+0000 INFO Remote interface available at http://0.0.0.0:7474/
2017-05-03 12:02:23.689+0000 WARN /browser/scripts/8eea4b31.components.js org.eclipse.jetty.util.SharedBlockingCallback$BlockerTimeoutException
java.io.IOException: org.eclipse.jetty.util.SharedBlockingCallback$BlockerTimeoutException
at org.eclipse.jetty.util.SharedBlockingCallback$Blocker.block(SharedBlockingCallback.java:234)

Caused by: org.eclipse.jetty.util.SharedBlockingCallback$BlockerTimeoutException

2017-05-03 12:02:23.690+0000 WARN /browser/scripts/8eea4b31.components.js org.eclipse.jetty.util.SharedBlockingCallback$BlockerTimeoutException
java.io.IOException: org.eclipse.jetty.util.SharedBlockingCallback$BlockerTimeoutException

Caused by: org.eclipse.jetty.util.SharedBlockingCallback$BlockerTimeoutException

2017-05-03 12:03:23.538+0000 WARN /browser/scripts/8eea4b31.components.js org.eclipse.jetty.util.SharedBlockingCallback$BlockerTimeoutException

Caused by: org.eclipse.jetty.util.SharedBlockingCallback$BlockerTimeoutException

2017-05-03 12:03:23.540+0000 WARN /browser/scripts/8eea4b31.components.js org.eclipse.jetty.util.SharedBlockingCallback$BlockerTimeoutException
java.io.IOException: org.eclipse.jetty.util.SharedBlockingCallback$BlockerTimeoutException

Caused by: org.eclipse.jetty.util.SharedBlockingCallback$BlockerTimeoutException
at org.eclipse.jetty.util.SharedBlockingCallback$Blocker.block(SharedBlockingCallback.java:216)
... 33 more
^C2017-05-03 12:10:26.531+0000 INFO Neo4j Server shutdown initiated by request
2017-05-03 12:10:26.566+0000 INFO Stopping...
2017-05-03 12:10:27.132+0000 INFO Stopped.
[admin@user01 neo4j-community-3.1.3]$

(1.5) Not possible to upgrade a store with version ‘v0.A.8’ to current store version v0.A.7 (Neo4j 3.1.0).

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
ERROR Failed to start Neo4j: Starting Neo4j failed: Component 'org.neo4j.server.database.LifecycleManagingDatabase@77b9886e' was successfully initialized, but failed to start. Please see attached cause exception. Starting Neo4j failed: Component 'org.neo4j.server.database.LifecycleManagingDatabase@77b9886e' was successfully initialized, but failed to start. Please see attached cause exception.
org.neo4j.server.ServerStartupException: Starting Neo4j failed: Component 'org.neo4j.server.database.LifecycleManagingDatabase@77b9886e' was successfully initialized, but failed to start. Please see attached cause exception.

Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.server.database.LifecycleManagingDatabase@77b9886e' was successfully initialized, but failed to start. Please see attached cause exception.

Caused by: java.lang.RuntimeException: Error starting org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory, /home/user1/neo4j_5687/neo4j-community-3.1.0/data/databases/graph.db

Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.kernel.NeoStoreDataSource@7c18987f' was successfully initialized, but failed to start. Please see attached cause exception.

Caused by: org.neo4j.kernel.impl.storemigration.StoreUpgrader$UnexpectedUpgradingStoreVersionException: Not possible to upgrade a store with version 'v0.A.8' to current store version `v0.A.7` (Neo4j 3.1.0).
at org.neo4j.kernel.impl.storemigration.UpgradableDatabase.checkUpgradeable(UpgradableDatabase.java:135)
at org.neo4j.kernel.impl.storemigration.StoreUpgrader.migrateIfNeeded(StoreUpgrader.java:130)
at org.neo4j.kernel.impl.storemigration.DatabaseMigrator.migrate(DatabaseMigrator.java:98)
at org.neo4j.kernel.NeoStoreDataSource.upgradeStore(NeoStoreDataSource.java:571)
at org.neo4j.kernel.NeoStoreDataSource.start(NeoStoreDataSource.java:440)
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:433)
... 14 more

把高版本的数据直接复制到低版本报错。
通过neo4j提供的数据迁移jar包迁移数据

(1.6) java.lang.IllegalArgumentException: Base directory ‘C:\ProfessionSofware\Neo4j\neo4j-community-3.3.4\certificates\default’ for SSL policy with name ‘default’ does not exist.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
C:\ProfessionSofware\Neo4j\neo4j-community-3.3.4\bin
λ neo4j console
2018-04-10 02:29:48.937+0000 INFO ======== Neo4j 3.3.4 ========
2018-04-10 02:29:48.981+0000 INFO Starting...
2018-04-10 02:29:49.477+0000 ERROR Failed to start Neo4j: Starting Neo4j failed: Component 'org.neo4j.server.database.LifecycleManagingDatabase@1f2586d6' was successfully initialized, but failed to start. Please see the attached cause exception "Base directory 'C:\ProfessionSofware\Neo4j\neo4j-community-3.3.4\certificates\default' for SSL policy with name 'default' does not exist.". Starting Neo4j failed: Component 'org.neo4j.server.database.LifecycleManagingDatabase@1f2586d6' was successfully initialized, but failed to start. Please see the attached cause exception "Base directory 'C:\ProfessionSofware\Neo4j\neo4j-community-3.3.4\certificates\default' for SSL policy with name 'default' does not exist.".
org.neo4j.server.ServerStartupException: Starting Neo4j failed: Component 'org.neo4j.server.database.LifecycleManagingDatabase@1f2586d6' was successfully initialized, but failed to start. Please see the attached cause exception "Base directory 'C:\ProfessionSofware\Neo4j\neo4j-community-3.3.4\certificates\default' for SSL policy with name 'default' does not exist.".

Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.server.database.LifecycleManagingDatabase@1f2586d6' was successfully initialized, but failed to start. Please see the attached cause exception "Base directory 'C:\ProfessionSofware\Neo4j\neo4j-community-3.3.4\certificates\default' for SSL policy with name 'default' does not exist.".

Caused by: java.lang.IllegalArgumentException: Base directory 'C:\ProfessionSofware\Neo4j\neo4j-community-3.3.4\certificates\default' for SSL policy with name 'default' does not exist.
at org.neo4j.kernel.configuration.ssl.SslPolicyLoader.load(SslPolicyLoader.java:184)
at org.neo4j.kernel.configuration.ssl.SslPolicyLoader.create(SslPolicyLoader.java:94)
at org.neo4j.kernel.impl.factory.CommunityEditionModule.<init>(CommunityEditionModule.java:103)
at org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory.initFacade(GraphDatabaseFacadeFactory.java:159)
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
2018-04-10 02:29:49.483+0000 INFO Neo4j Server shutdown initiated by request

ssl配置问题
修改neo4j.conf里的配置

(2) Neo4j-DespTop(前端展示)问题

(2.1) WebSocket connection failure

1
WebSocket connection failure. Due to security constraints in your web browser, the reason for the failure is not available to this Neo4j Driver. Please use your browsers development console to determine the root cause of the failure. Common reasons include the database being unavailable, using the wrong connection URL or temporary network problems. If you have enabled encryption, ensure your browser is configured to trust the certificate Neo4j is configured to use. WebSocket `readyState` is: 3

分2种情况:

  1. neo4j版本在3.2.0以前
    1.1 换浏览器
    1.2 在右边的设置里(齿轮图标),把Do not use Bolt勾选上
  2. neo4j版本3.2.0及以上
    1. 在浏览器里禁用bolt
    2. 在neo4j.conf里禁用bolt
    3. 检查JDK版本,推荐使用JDK 1.8, JDK 1.7或者1.9 可能出问题

前端页面打不开

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
2019-06-18 10:37:55.940+0800 WARN  /browser/vendor-d594bc0d621572ced6b1.js org.eclipse.jetty.util.SharedBlockingCallback$BlockerTimeoutException
java.io.IOException: org.eclipse.jetty.util.SharedBlockingCallback$BlockerTimeoutException
at org.eclipse.jetty.util.SharedBlockingCallback$Blocker.block(SharedBlockingCallback.java:213)
...
at java.lang.Thread.run(Thread.java:748)
Caused by: org.eclipse.jetty.util.SharedBlockingCallback$BlockerTimeoutException
at org.eclipse.jetty.util.SharedBlockingCallback$Blocker.block(SharedBlockingCallback.java:195)
... 33 more
2019-06-18 10:37:55.941+0800 WARN /browser/vendor-d594bc0d621572ced6b1.js org.eclipse.jetty.util.SharedBlockingCallback$BlockerTimeoutException
java.io.IOException: org.eclipse.jetty.util.SharedBlockingCallback$BlockerTimeoutException
at org.eclipse.jetty.util.SharedBlockingCallback$Blocker.block(SharedBlockingCallback.java:213)
...
at java.lang.Thread.run(Thread.java:748)
Caused by: org.eclipse.jetty.util.SharedBlockingCallback$BlockerTimeoutException
at org.eclipse.jetty.util.SharedBlockingCallback$Blocker.block(SharedBlockingCallback.java:195)
... 33 more
2019-06-18 10:37:55.949+0800 WARN /browser/app-d594bc0d621572ced6b1.js org.eclipse.jetty.util.SharedBlockingCallback$BlockerTimeoutException
java.io.IOException: org.eclipse.jetty.util.SharedBlockingCallback$BlockerTimeoutException
at org.eclipse.jetty.util.SharedBlockingCallback$Blocker.block(SharedBlockingCallback.java:213)
...
at java.lang.Thread.run(Thread.java:748)
Caused by: org.eclipse.jetty.util.SharedBlockingCallback$BlockerTimeoutException
at org.eclipse.jetty.util.SharedBlockingCallback$Blocker.block(SharedBlockingCallback.java:195)
... 33 more
2019-06-18 10:37:55.950+0800 WARN /browser/app-d594bc0d621572ced6b1.js org.eclipse.jetty.util.SharedBlockingCallback$BlockerTimeoutException
java.io.IOException: org.eclipse.jetty.util.SharedBlockingCallback$BlockerTimeoutException
at org.eclipse.jetty.util.SharedBlockingCallback$Blocker.block(SharedBlockingCallback.java:213)
...
at java.lang.Thread.run(Thread.java:748)
Caused by: org.eclipse.jetty.util.SharedBlockingCallback$BlockerTimeoutException
at org.eclipse.jetty.util.SharedBlockingCallback$Blocker.block(SharedBlockingCallback.java:195)
... 33 more

(3) 导入数据问题

(3.1) Expected ‘–nodes’ to have at least 1 valid item, but had 0 []

1
2
3
4
5
6
7
8
9
10
11
12
13
14
C:\ProfessionSofware\Neo4j\neo4j-community-3.1.2\bin>neo4j-import  --into retail.db  --id-type string  --nodes:Customer  customers.csv  --nodes  products.csv  --nodes orders_header.csv,orders1.csv,orders2.csv  --relationships:CONTAINS order_details.csv  --relationships:ORDERED customer_orders_header.csv,orders1.csv,orders2.csv
警告: This command does not appear to be running with administrative rights. Some commands may fail e.g. Start/Stop
WARNING: neo4j-import is deprecated and support for it will be removed in a future
version of Neo4j; please use neo4j-admin import instead.

Input error: Expected '--nodes' to have at least 1 valid item, but had 0 []
Caused by:Expected '--nodes' to have at least 1 valid item, but had 0 []
java.lang.IllegalArgumentException: Expected '--nodes' to have at least 1 valid item, but had 0 []
at org.neo4j.kernel.impl.util.Validators.lambda$atLeast$6(Validators.java:125)
at org.neo4j.helpers.Args.validated(Args.java:640)
at org.neo4j.helpers.Args.interpretOptionsWithMetadata(Args.java:608)
at org.neo4j.tooling.ImportTool.extractInputFiles(ImportTool.java:503)
at org.neo4j.tooling.ImportTool.main(ImportTool.java:388)
at org.neo4j.tooling.ImportTool.main(ImportTool.java:334)

(3.2) Error in input data

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
C:\ProfessionSofware\Neo4j\neo4j-community-3.1.2\bin>neo4j-import -into test.db  --id-type string  --nodes:Test C:/User/wdb/2017-04-06_test.csv  --stacktrace truektrace true  --skip-duplicate-nodes true
警告: This command does not appear to be running with administrative rights. Some commands may fail e.g. Start/Stop
WARNING: neo4j-import is deprecated and support for it will be removed in a future
version of Neo4j; please use neo4j-admin import instead.

Neo4j version: 3.1.2
Importing the contents of these files into test.db:
Nodes:
:Test
C:\User\wdb\2017-04-06_test.csv

Available resources:
Free machine memory: 3.74 GB
Max heap memory : 1.77 GB
Processors: 4

Nodes
Error in input data
Caused by:ERROR in input
data source: BufferedCharSeeker[source:C:\User\wdb\2017-04-06_test.csv, position:654, line:11]
in field: mobile:int:6
for header: [dep:string, uid:int, name:string, tel:int, fax:string, mobile:int, email:string, id:string]
raw field value: 13900001111
original error: Not supported a.t.m

错误原因是 用int表示电话号码,超范围了。最后换成用String保存电话号码。

(3.2) Missing header od type start_id

import date has problem , please check the data
数据有问题,检查csv文件里的数据格式,看少了什么东西

(4) 工程问题

## (4.1) Cannot determine embedded database driver class for database type NONE.

1
2
3
4
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private javax.sql.DataSource org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration.dataSource; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration$NonEmbeddedConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration$NonEmbeddedConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).
Caused by: org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).

spring-data-jpa 和 spring-data-neo4j 不兼容,只能升级版本解决了

(4.2) org.neo4j.driver.v1.exceptions.ClientException: You cannot begin a transaction on a session with an open transaction;

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
org.neo4j.driver.v1.exceptions.ClientException: You cannot begin a transaction on a session with an open transaction; either run from within the transaction or use a different session.
at org.neo4j.driver.internal.InternalSession.ensureNoOpenTransactionBeforeOpeningTransaction(InternalSession.java:196)
at org.neo4j.driver.internal.InternalSession.ensureConnectionIsValidBeforeOpeningTransaction(InternalSession.java:167)
at org.neo4j.driver.internal.InternalSession.beginTransaction(InternalSession.java:135)
at org.neo4j.jdbc.bolt.BoltPreparedStatement.executeInternal(BoltPreparedStatement.java:89)
at org.neo4j.jdbc.bolt.BoltPreparedStatement.executeQuery(BoltPreparedStatement.java:54)
at com.xxxx.xxxx.odk.neo4j.utils.CypherResult.getCypherResultList(CypherResult.java:34)
at com.xxxx.xxxx.odk.neo4j.search.impl.JdbcSearchImpl.getRelationshipsBetweenTwoDifferentLabelNodes(JdbcSearchImpl.java:399)
at com.xxxx.xxxx.xxxxxxxx.service.impl.OperationServiceImpl.getDetailInformation(OperationServiceImpl.java:95)
at com.xxxx.xxxx.xxxxxxxx.controller.OperationController.getDetailInformation(OperationController.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:114)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)

事务的问题,多看看事务的资料

(4.3) Exception in thread “Thread-0” org.neo4j.driver.v1.exceptions.ClientException: Unable to connect to ‘172.23.22.27’ on port 7687, ensure the database is running and that there is a working network connection to it.

1
2
Exception in thread "Thread-0" org.neo4j.driver.v1.exceptions.ClientException: Unable to connect to '172.23.22.27' on port 7687, ensure the database is running and that there is a working network connection to it.
at org.neo4j.driver.internal.connector.socket.SocketClient.start(SocketClient.java:82)

使用neo4j-java-driver时,用完连接没有释放,导致连接用尽。
在使用完注意加上 session.close(); driver.close();

(4.4) org.neo4j.driver.v1.exceptions.clientException General SSLEngine problem

1
org.neo4j.driver.v1.exceptions.clientException  General SSLEngine problem
  1. 在当前用户的目录下找 .neo4j/known_hosts 文件,找到后删除就可以了
  2. 在新版本里,SSL认证方式发生变化,需要修改配置文件neo4j.conf,修改70行,102行,103行,把前面的#去掉,重启neo4j数据库
  3. dbms.connector.bolt.tls_level=DISABLED
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Bolt connector
dbms.connector.bolt.enabled=true
dbms.connector.bolt.tls_level=OPTIONAL
dbms.connector.bolt.listen_address=:5687


#*****************************************************************
# SSL system configuration
#*****************************************************************

# Names of the SSL policies to be used for the respective components.

# The legacy policy is a special policy which is not defined in
# the policy configuration section, but rather derives from
# dbms.directories.certificates and associated files
# (by default: neo4j.key and neo4j.cert). Its use will be deprecated.

# The policies to be used for connectors.
#
# N.B: Note that a connector must be configured to support/require
# SSL/TLS for the policy to actually be utilized.
#
# see: dbms.connector.*.tls_level

bolt.ssl_policy=legacy
https.ssl_policy=legacy

I think you need to delete the file ~/neo/known_hosts (or at least open it and delete the line that starts with localhost:7687). When you are using trust-on-first-use the driver will accept the first certificate it sees and store it in the known_hosts-file, if the driver sees any other certificates it will reject them. However when you upgrade the server it will generate a new certificate and it will no longer match the certificate in the known_hosts-file.

(4.5) Caused by: java.io.IOException: Broken pipe

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
org.neo4j.driver.v1.exceptions.ClientException: Unable to send messages to server: Broken pipe
org.neo4j.driver.v1.exceptions.ClientException: Unable to send messages to server: Broken pipe

Caused by: java.io.IOException: Broken pipe
at sun.nio.ch.FileDispatcherImpl.write0(Native Method)
at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47)
at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93)
at sun.nio.ch.IOUtil.write(IOUtil.java:51)
at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:471)
at org.neo4j.driver.internal.connector.socket.TLSSocketChannel.wrap(TLSSocketChannel.java:282)
at org.neo4j.driver.internal.connector.socket.TLSSocketChannel.write(TLSSocketChannel.java:390)
at org.neo4j.driver.internal.connector.socket.ChunkedOutput.flush(ChunkedOutput.java:62)
at org.neo4j.driver.internal.packstream.PackStream$Packer.flush(PackStream.java:173)
at org.neo4j.driver.internal.messaging.PackStreamMessageFormatV1$Writer.flush(PackStreamMessageFormatV1.java:329)
at org.neo4j.driver.internal.messaging.PackStreamMessageFormatV1$Writer.flush(PackStreamMessageFormatV1.java:100)
at org.neo4j.driver.internal.connector.socket.SocketClient.send(SocketClient.java:114)
at org.neo4j.driver.internal.connector.socket.SocketConnection.flush(SocketConnection.java:108)
... 113 more
  1. 程序有问题,报错太多了
  2. ulimit没有优化,设置ulimit

这个异常是客户端读取超时关闭了连接,这时候服务器端再向客户端已经断开的连接写数据时就发生了broken pipe异常!

java.io.IOException 断开的管道 解决方法 ClientAbortException: java.io.IOException: Broken pipe
What causes the Broken Pipe Error?

(4.x)

1
2
3
4
5
6
C:\ProfessionSofware\Neo4j\neo4j-community-3.1.0\bin
λ neo4j console
2018-04-28 01:40:12.128+0000 INFO Starting...
2018-04-28 01:40:13.614+0000 INFO Bolt enabled on 0.0.0.0:7687.
2018-04-28 01:40:19.501+0000 INFO Started.
2018-04-28 01:40:20.920+0000 INFO Remote interface available at http://localhost:7474/
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
WKQ@WKQ-PC MINGW64 /c/ProfessionSofware/Neo4j/neo4j-community-3.1.0/data/databases
$ rm -rf graph.db/
rm: cannot remove 'graph.db/neostore': Device or resource busy
rm: cannot remove 'graph.db/neostore.counts.db.a': Device or resource busy
rm: cannot remove 'graph.db/neostore.id': Device or resource busy
rm: cannot remove 'graph.db/neostore.labeltokenstore.db': Device or resource busy
rm: cannot remove 'graph.db/neostore.labeltokenstore.db.id': Device or resource busy
rm: cannot remove 'graph.db/neostore.labeltokenstore.db.names': Device or resource busy
rm: cannot remove 'graph.db/neostore.labeltokenstore.db.names.id': Device or resource busy
rm: cannot remove 'graph.db/neostore.nodestore.db': Device or resource busy
rm: cannot remove 'graph.db/neostore.nodestore.db.id': Device or resource busy
rm: cannot remove 'graph.db/neostore.nodestore.db.labels': Device or resource busy
rm: cannot remove 'graph.db/neostore.nodestore.db.labels.id': Device or resource busy
rm: cannot remove 'graph.db/neostore.propertystore.db': Device or resource busy
rm: cannot remove 'graph.db/neostore.propertystore.db.arrays': Device or resource busy
rm: cannot remove 'graph.db/neostore.propertystore.db.arrays.id': Device or resource busy
rm: cannot remove 'graph.db/neostore.propertystore.db.id': Device or resource busy
rm: cannot remove 'graph.db/neostore.propertystore.db.index': Device or resource busy
rm: cannot remove 'graph.db/neostore.propertystore.db.index.id': Device or resource busy
rm: cannot remove 'graph.db/neostore.propertystore.db.index.keys': Device or resource busy
rm: cannot remove 'graph.db/neostore.propertystore.db.index.keys.id': Device or resource busy
rm: cannot remove 'graph.db/neostore.propertystore.db.strings': Device or resource busy
rm: cannot remove 'graph.db/neostore.propertystore.db.strings.id': Device or resource busy
rm: cannot remove 'graph.db/neostore.relationshipgroupstore.db': Device or resource busy
rm: cannot remove 'graph.db/neostore.relationshipgroupstore.db.id': Device or resource busy
rm: cannot remove 'graph.db/neostore.relationshipstore.db': Device or resource busy
rm: cannot remove 'graph.db/neostore.relationshipstore.db.id': Device or resource busy
rm: cannot remove 'graph.db/neostore.relationshiptypestore.db': Device or resource busy
rm: cannot remove 'graph.db/neostore.relationshiptypestore.db.id': Device or resource busy
rm: cannot remove 'graph.db/neostore.relationshiptypestore.db.names': Device or resource busy
rm: cannot remove 'graph.db/neostore.relationshiptypestore.db.names.id': Device or resource busy
rm: cannot remove 'graph.db/neostore.schemastore.db': Device or resource busy
rm: cannot remove 'graph.db/neostore.schemastore.db.id': Device or resource busy
rm: cannot remove 'graph.db/neostore.transaction.db.0': Device or resource busy
rm: cannot remove 'graph.db/store_lock': Device or resource busy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
2018-04-28 01:44:15.449+0000 INFO  Neo4j Server shutdown initiated by request
2018-04-28 01:44:15.517+0000 INFO Stopping...
终止批处理操作吗(Y/N)? Exception in thread "Thread-11" java.lang.RuntimeException: org.neo4j.kernel.lifecycle.LifecycleException: Failed to transition component 'org.ne
o4j.kernel.NeoStoreDataSource$5@58dcfcb2' from STOPPED to SHUTTING_DOWN. Please see attached cause exception

Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Failed to transition component 'org.neo4j.kernel.NeoStoreDataSource$5@58dcfcb2' from STOPPED to SHUTTING_DOWN. Please see attached cause exception

Suppressed: org.neo4j.kernel.lifecycle.LifecycleException: Failed to transition component 'org.neo4j.kernel.impl.storageengine.impl.recordstorage.RecordStorageEngine@6661b54d' from STOPPED to SHUTTING_DOWN. Please see attached cause exception

Caused by: java.io.IOException: Exception closing multiple resources

Caused by: java.io.IOException: Exception closing multiple resources

Caused by: java.nio.file.NoSuchFileException: C:\ProfessionSofware\Neo4j\neo4j-community-3.1.0\data\databases\graph.db\schema\label\lucene\labelStore\1\write.lock

Suppressed: java.nio.file.NoSuchFileException: C:\ProfessionSofware\Neo4j\neo4j-community-3.1.0\data\databases\graph.db\schema\label\lucene\labelStore\1\_1.cfe
at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:79)

Suppressed: org.neo4j.kernel.lifecycle.LifecycleException: Failed to transition component 'org.neo4j.kernel.impl.pagecache.PageCacheLifecycle@6df2bf5d' from STOPPED to SHUTTING_DOWN. Please see attached cause exception

Caused by: java.lang.IllegalStateException: Cannot close the PageCache while files are still mapped:
C:\ProfessionSofware\Neo4j\neo4j-community-3.1.0\data\databases\graph.db\neostore (1 mapping)
C:\ProfessionSofware\Neo4j\neo4j-community-3.1.0\data\databases\graph.db\neostore.counts.db.a (1 mapping)
C:\ProfessionSofware\Neo4j\neo4j-community-3.1.0\data\databases\graph.db\neostore.relationshipgroupstore.db (1 mapping)
C:\ProfessionSofware\Neo4j\neo4j-community-3.1.0\data\databases\graph.db\neostore.schemastore.db (1 mapping)
C:\ProfessionSofware\Neo4j\neo4j-community-3.1.0\data\databases\graph.db\neostore.labeltokenstore.db (1 mapping)
C:\ProfessionSofware\Neo4j\neo4j-community-3.1.0\data\databases\graph.db\neostore.labeltokenstore.db.names (1 mapping)
C:\ProfessionSofware\Neo4j\neo4j-community-3.1.0\data\databases\graph.db\neostore.relationshiptypestore.db (1 mapping)
C:\ProfessionSofware\Neo4j\neo4j-community-3.1.0\data\databases\graph.db\neostore.relationshiptypestore.db.names (1 mapping)
C:\ProfessionSofware\Neo4j\neo4j-community-3.1.0\data\databases\graph.db\neostore.relationshipstore.db (1 mapping)
C:\ProfessionSofware\Neo4j\neo4j-community-3.1.0\data\databases\graph.db\neostore.propertystore.db (1 mapping)
C:\ProfessionSofware\Neo4j\neo4j-community-3.1.0\data\databases\graph.db\neostore.propertystore.db.arrays (1 mapping)
C:\ProfessionSofware\Neo4j\neo4j-community-3.1.0\data\databases\graph.db\neostore.propertystore.db.strings (1 mapping)
C:\ProfessionSofware\Neo4j\neo4j-community-3.1.0\data\databases\graph.db\neostore.propertystore.db.index (1 mapping)
C:\ProfessionSofware\Neo4j\neo4j-community-3.1.0\data\databases\graph.db\neostore.propertystore.db.index.keys (1 mapping)
C:\ProfessionSofware\Neo4j\neo4j-community-3.1.0\data\databases\graph.db\neostore.nodestore.db (1 mapping)
C:\ProfessionSofware\Neo4j\neo4j-community-3.1.0\data\databases\graph.db\neostore.nodestore.db.labels (1 mapping)
at org.neo4j.io.pagecache.impl.muninn.MuninnPageCache.close(MuninnPageCache.java:610)
at org.neo4j.kernel.impl.pagecache.PageCacheLifecycle.shutdown(PageCacheLifecycle.java:42)
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.shutdown(LifeSupport.java:488)
... 10 more
Caused by: org.neo4j.kernel.impl.store.UnderlyingStorageException: java.nio.file.NoSuchFileException: C:\ProfessionSofware\Neo4j\neo4j-community-3.1.0\data\databases\graph.db\schema\label\lucene\labelStore\1\write.lock

Caused by: java.nio.file.NoSuchFileException: C:\ProfessionSofware\Neo4j\neo4j-community-3.1.0\data\databases\graph.db\schema\label\lucene\labelStore\1\write.lock

(5) 部署问题

(5.1) no suitable driver foune

no suitable driver foune for jdbc:neo4j:http:http://127.0.0.1:7474

  1. Class.forName(url).newInstance()
  2. 把jar放在$jre/lib/ext下面

(5.2) WARNING: Max 1024 open files allowed, minimum of 40000 recommended. See the Neo4j manual.

1
2
3
4
5
6
[admin@user01 neo4j-community-3.1.3]$ ./bin/neo4j start
Starting Neo4j.
WARNING: Max 1024 open files allowed, minimum of 40000 recommended. See the Neo4j manual.
Started neo4j (pid 8480). It is available at http://localhost:7474/
There may be a short delay until the server is ready.
See /home/admin/databases/neo4j-community-3.1.3/logs/neo4j.log for current status.

Linux平台对用户可能打开的并发文件的数量施加了上限。默认是1024。使用ulimit -n命令为当前用户和会话查看
ulimit -n
把用户可打开的并发文件数量改大点,比如改成40000。

切换成root用户
编辑/etc/security/limits.conf并添加以下两行:
neo4j soft nofile 40000
neo4j hard nofile 40000
编辑/etc/pam.d/su并取消注释或添加以下行:
会话需要pam_limits.so
需要重新启动才能使设置生效。
在上述过程之后,neo4j用户将具有40,000个同时打开文件的限制。如果您继续遇到太多打开文件或Could not stat()目录的异常,则可能需要进一步提高限制。

(6) neo4j-community限制问题

org.springframework.dao.DataRetrievalFailureException: ‘type‘ on

org.springframework.dao.DataRetrievalFailureException: '__type__' on

neo4j-community 最多允许 2^35个节点,2^35个关系,2^36个属性,属性类型不能超过2^16个
属性类型超过65535个了 (类似于MySQL里字段超过65535个)

References

[1] https://neo4j.com/docs/
[2] https://stackoverflow.com/questions/13803609/dataretrievalfailureexception-type-not-found-in-spring-data-neo4j
[3] https://groups.google.com/forum/#!topic/neo4j/aFZCp5T3ABo
[4] https://github.com/neo4j/neo4j-java-driver/issues/174
[5] https://stackoverflow.com/questions/37240461/general-sslengine-error-in-neo4j