java - 在 neo4j 中出现以下错误 "org.neo4j.kernel.api.exceptions.TransactionFailureException: Transaction rolled back even if marked as successful"

标签 java neo4j graph-databases

在neo4j中编写存储过程,然后将其添加到neo4j插件中。调用存储过程时出现错误”

org.neo4j.kernel.api.exceptions.TransactionFailureException: Transaction rolled back even if marked as successful

以下是有关我的表现的一些信息。

@Procedure("example.search12")
public Stream<SearchHit> searchData(
    @Name("phoneNumber") String phoneNumber, 
    @Name("searchText") String searchText) throws InterruptedException, ExecutionException {

    List<SearchHit> resultList = new ArrayList<>();
    try {
        Node startNode = getStartNode(phoneNumber);
        if(null == startNode){
            System.out.println("Phone Number not found::"+ phoneNumber);
            return null;
        }
        final Set<Node> results = new LinkedHashSet<>();
        innerSeacrh(db, startNode, searchText, 1,results);
        List<Node> nodes = new ArrayList<Node>();

        for (Node node : results) {
            System.out.println(node.getProperty("fullname"));
            nodes.add(node);
            resultList.add(new SearchHit(node));
        }
    } catch(Exception ex) {
        ex.printStackTrace();
    }

    return resultList.stream();
}

public static class SearchHit {
    // This records contain a single field named 'nodeId'
    public long nodeId;

    public SearchHit(Node node) {
        this.nodeId = node.getId();
    }
}

我通过以下命令调用存储过程:

call example.search12("919818131043","anu");

出现以下错误。

org.neo4j.kernel.api.exceptions.TransactionFailureException: Transaction rolled back even if marked as successful

请帮助我尽快解决它。

最佳答案

我已经解决了这个问题。实际上,当我们点击存储过程时,它会隐式打开一个事务,因此如果您尝试在同一线程中打开另一个事务。它会带来问题。

关于java - 在 neo4j 中出现以下错误 "org.neo4j.kernel.api.exceptions.TransactionFailureException: Transaction rolled back even if marked as successful",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38091795/

相关文章:

php - 图结构数据库和 Php

java - saveAsTextFile() 将最终的 RDD 写入单个文本文件 - Apache Spark

java - Mockito - 创建一个模拟为 Spring Bean

java - 为什么在java中以multipart/form-data发送文件时我们必须同时使用Writer和OutputStream?

neo4j - 如何正确添加关系到neo4j(cypher)?

java - Cypher - 通过属性中的字符串聚合节点

java - Java中的标签break语句: compile time error

python - 我正在使用 py2neo 将 python 连接到 neo4j 数据库

nosql - Neo4j(或其他一些图形数据库)可以处理关系之间的关系吗?

OrientDB:创建从父到子的边缘