java - 空间数据加载后无法启动 Neo4j Server

标签 java neo4j

我一直在尝试使用 Neo4j Spatial 插件来通过 Java 加载数据。我已经添加了该插件,当我启动一个空数据库时,可以通过以下对服务器的 GET 请求来确认这一点。

{
    "extensions": {
        "SpatialPlugin": {
            "addSimplePointLayer": "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/addSimplePointLayer",
            "findClosestGeometries": "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/findClosestGeometries",
            "addNodesToLayer": "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/addNodesToLayer",
            "addGeometryWKTToLayer": "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/addGeometryWKTToLayer",
            "findGeometriesWithinDistance": "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/findGeometriesWithinDistance",
            "addEditableLayer": "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/addEditableLayer",
            "addCQLDynamicLayer": "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/addCQLDynamicLayer",
            "addNodeToLayer": "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/addNodeToLayer",
            "getLayer": "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/getLayer",
            "findGeometriesInBBox": "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/findGeometriesInBBox",
            "updateGeometryFromWKT": "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/updateGeometryFromWKT"
        }
    },
    "node": "http://localhost:7474/db/data/node",
    "node_index": "http://localhost:7474/db/data/index/node",
    "relationship_index": "http://localhost:7474/db/data/index/relationship",
    "extensions_info": "http://localhost:7474/db/data/ext",
    "relationship_types": "http://localhost:7474/db/data/relationship/types",
    "batch": "http://localhost:7474/db/data/batch",
    "cypher": "http://localhost:7474/db/data/cypher",
    "indexes": "http://localhost:7474/db/data/schema/index",
    "constraints": "http://localhost:7474/db/data/schema/constraint",
    "transaction": "http://localhost:7474/db/data/transaction",
    "node_labels": "http://localhost:7474/db/data/labels",
    "neo4j_version": "2.3.2"
}

但是,当我停止服务器时,通过 Java 使用 SpatialIndexProvider.SIMPLE_WKT_CONFIG 索引加载空间数据,然后添加它:

        try (Transaction tx = db.beginTx()) {
            Index<Node> index = db.index().forNodes("location", SpatialIndexProvider.SIMPLE_WKT_CONFIG);

            for (String line : lines) {
                String[] columns = line.split(",");
                Node node = db.createNode();
                node.setProperty("wkt", String.format("POINT(%s %s)", columns[4], columns[3]));
                node.setProperty("name", columns[0]);
                index.add(node, "dummy", "value");
            }

            tx.success();
        }

重新启动后,出现错误:

2016-02-23 13:44:36.747+0000 ERROR [o.n.k.KernelHealth] setting TM not OK. Kernel has encountered some problem, please perform necessary action (tx recovery/restart) No index provider 'spatial' found. Maybe the intended provider (or one more of its dependencies) aren't on the classpath or it failed to load.

在 graph.db 内的 Messages.log 中。有什么明显的地方我做错了吗?

我使用的是 Windows 8、Neo4j 2.3.2、Java 8 和 neo4j-spatial-0.15-neo4j-2.3.0.jar

最佳答案

您是否将完整的空间 zip 解压到插件目录中?

否则无法找到空间需要的一些类。

关于java - 空间数据加载后无法启动 Neo4j Server,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35579795/

相关文章:

neo4j - Cypher zipper 系列

elasticsearch - 图形,文本和分析组合搜索

java - 使用java从文本文件中读取数据行

java - JComboBox 在removeAllItems() 时引用旧框架

java - 线程中的异常 "AWT-EventQueue-0"java.lang.NumberFormatException : For input string: "11101110110100011110111011010001"

java - 在 Spring Boot 2 中使用实体管理器时,没有类型 'javax.persistence.EntityManager' 的合格 bean

neo4j - 在 neo4j 中获取叶子的第一个根

java - 通用数据记录无法转换为 Avro

groovy - SDN 4 Gradle 设置

neo4j - 如何在Neo4j/Cypher中返回复合对象