NullPointerException升级Neo4j 3.3.1后访问索引

时间:2018-06-26 14:07:00

标签: java neo4j cypher graph-databases neo4j-embedded

我已将Neo4j从2.3.8升级到3.3.1。访问 hits = index.query(query); 时,我得到了nullPointerException。 下面是我的代码。

protected Record getNext() throws Exception {          
Transaction tx=neo.beginTx();
try {
    if (hits == null) {
        if (query!=null) {
        hits = index.query(query);
      tx.success();       
    } 
    }
    T next = hits.next();
    if (next == null) {
        return finished();
    } else {
        return nodeToRecord.call(next);
    }
}

您可以在上面的代码中检查我正在检查的查询!= null,但仍会得到nullpointer。索引有问题吗?

以下是错误

 Unexpected error : java.lang.NullPointerException
    at au.com.graph.NodeIterator.getNext(GraphNodeIterator.java:64)
    at au.com.graph.NodeIterator.getNext.getNext(GraphNodeIterator.java:22)
    at com.googlecode.totallylazy.iterators.StatefulIterator.hasNext(StatefulIterator.java:23)
    at com.googlecode.totallylazy.iterators.StatefulIterator.next(StatefulIterator.java:36)
    at com.googlecode.totallylazy.Computation$2.call(Computation.java:80)
    at com.googlecode.totallylazy.callables.LazyCallable.get(LazyCallable.java:19)
    at com.googlecode.totallylazy.Lazy.call(Lazy.java:22)
    at com.googlecode.totallylazy.Computation.isEmpty(Computation.java:121)

0 个答案:

没有答案