Java neo4j删除和内部500错误



当我像这样的测试后删除neo4j数据库

  public static final DatabaseOperation clearDatabaseOperation = new DatabaseOperation() {
    @Override public void performOperation(GraphDatabaseService db) {
        //This is deprecated on the GraphDatabaseService interface,
        // but the alternative is not supported by implementation (RestGraphDatabase)
        for (Node node : db.getAllNodes()) {
            for (Relationship relationship : node.getRelationships()) {
                relationship.delete();
            }
            boolean notTheRootNode = node.getId() != 0;
            if (notTheRootNode) {
                node.delete();
            }
        }

通过AJAX搜索查询数据库(即在空数据库上搜索)时,它会返回内部500错误)

localhost:9000/search-results?keywords=t 500 Internal Server Error
        197ms

但是,如果我像此一样手动删除数据库

start r=relationship(*) delete r;
start n=node(*) delete n;

没有例外

在呼叫和返回中,我的代码很可能是我的代码问题。

只是在徘徊为什么错误仅在上面的方案之一而不是两个

上工作

使用Cypher,

您可能应该更明显地说您使用REST-GRAPH-DATABASE。

您是在删除后还是在删除后查询?

请在data/graph.db/messages.logdata/log/console.log中检查您的日志以找到错误原因。

也许您还可以查看HTTP-500请求的响应主体

根据您的错误,我想您的数据在删除后正在损坏。

我使用了与您相同的代码并删除了节点,除了我将迭代器放在交易中并在操作后关闭数据库。

,例如

Transaction _tx = _db.beginTx();
    try {
        for ( your conditions){             
            Your code
        }
        _tx.success();
    } catch (Exception e) {
        _logger.error(e.getMessage());
    }finally{
        _tx.finish();
        _db.shutdown();
        graphDbFactory.cleanUp();
    }

希望它对您有用。

相关内容

最新更新