nebula-java客户端执行insert语句之后接口挂

nebula 3.2.0
java 3.0.0
jdk 11
在执行insert语句之后会出现接口挂掉,返回500,但是查询语句例如match不会。请问是为什么?

public int Insert_vulner(Session s, String space, String vulner_id, String summary, String published, String file_id) throws IOErrorException, UnsupportedEncodingException {
        s.execute("Use " + space);
        String insertVulner_nGQL = "INSERT VERTEX vulner (summary, published) VALUES \"" + vulner_id + "\":(\"" + summary + "\", \"" + published + "\");";
        String insertEdge_nGQL = "INSERT EDGE Include () VALUES \"" + file_id + "\"->\"" + vulner_id + "\":();";
        s.execute(insertVulner_nGQL);
        s.execute(insertEdge_nGQL);
        // vulner_id = "`" + vulner_id + "`";
        // file_id = "`" + file_id + "`";
        vulnerabilityAnnotationService.tracking(vulner_id, file_id);
        // s.execute("REBUILD TAG INDEX vulner_index");
        return 1;
    }

    public void tracking(String vulnerabilityId, String targetId) throws IOErrorException, UnsupportedEncodingException {
        // 获取子图
        Session s = nebularGraphConfig.getSession();
        s.execute("Use boost_all_include");
        ResultSet r = s.execute("GET SUBGRAPH 5 STEPS FROM \""+vulnerabilityId+"\" IN Include YIELD VERTICES AS nodes");
        //List<ValueWrapper> pathList = nebularGraphUtil.getSubGraph(targetId, "Include", vulnerabilityStep, false);
        // 先遍历所有的路径
        for (int i = 0; i < r.rowsSize(); i++) {
            for (ValueWrapper n: r.rowValues(i).values().get(0).asList()) {
                ResultSet resp = null;
                String insertEdge_nGQL = "INSERT EDGE affected () VALUES \"" + vulnerabilityId + "\"->" + n.asNode().getId().toString() + ":();";
                try {
                    resp = s.execute(insertEdge_nGQL);
                    if (!resp.isSucceeded()) {
                        log.error(String.format("Execute: `%s', failed: %s",
                        insertEdge_nGQL, resp.getErrorMessage()));
                        throw new ApiException("边插入失败!");
                     }
                    log.info("边插入成功!");
                 } catch (IOErrorException e) {
                    e.printStackTrace();
                  }
            }
        }
        s.release();
    }

这是接口和插入函数的写法,thx!

1 个赞

接口挂,返回500。 这里是谁返回500? 可以把错误堆栈贴出来吗

{
  "timestamp": 1668579279964,
  "status": 500,
  "error": "Internal Server Error",
  "message": "",
  "path": "/insertVulner/inset_vulner"
}

你这是springboot服务吧,500是你的http请求的响应码。
你还是把Inser_vulner接口里面加上try-catch吧,catch中把错误堆栈打出来看看是什么错误

insert_vulner这个接口单独执行没问题,会返回1,但是执行完了之后再执行服务上面的其他接口就全挂了。

那你别的接口是怎么写的,一块贴出来,包括你执行别的接口都挂的堆栈信息贴一下

此话题已在最后回复的 30 天后被自动关闭。不再允许新回复。