void fireQuery()
{
String rows = "";
engine = new ExecutionEngine( graphDB );
Transaction tx = graphDB.beginTx();
try
{
ExecutionResult result = engine.execute("START n = node(*) RETURN n");
for ( Map<String, Object> row : result ) //THIS IS THE LINE WHERE ERROR IS OCCURING
{
for ( Entry<String, Object> column : row.entrySet() )
{
rows += column.getKey() + ": " + column.getValue() + "; ";
}
rows += "\n";
}
tx.success();
}
finally
{
tx.finish();
}
}
我收到以下错误消息
Exception in thread "main" java.lang.NullPointerException
at org.neo4j.kernel.impl.nioneo.xa.NioNeoDbPersistenceSource.getHighestPossibleIdInUse(NioNeoDbPersistenceSource.java:111)
at org.neo4j.kernel.impl.core.NodeManager.getHighestPossibleIdInUse(NodeManager.java:983)
at org.neo4j.kernel.impl.core.NodeManager$1.<init>(NodeManager.java:354)
at org.neo4j.kernel.impl.core.NodeManager.getAllNodes(NodeManager.java:352)
at org.neo4j.tooling.GlobalGraphOperations$1.iterator(GlobalGraphOperations.java:66)
at org.neo4j.cypher.internal.spi.gdsimpl.GDSBackedQueryContext$$anon$1.all(GDSBackedQueryContext.scala:90)
at org.neo4j.cypher.internal.executionplan.builders.GraphGlobalStartBuilder$$anonfun$createStartPipe$1.apply(GraphGlobalStartBuilder.scala:50)
at org.neo4j.cypher.internal.executionplan.builders.GraphGlobalStartBuilder$$anonfun$createStartPipe$1.apply(GraphGlobalStartBuilder.scala:50)
at org.neo4j.cypher.internal.pipes.StartPipe$$anonfun$internalCreateResults$1.apply(StartPipe.scala:36)
at org.neo4j.cypher.internal.pipes.StartPipe$$anonfun$internalCreateResults$1.apply(StartPipe.scala:35)
at scala.collection.Iterator$$anon$13.hasNext(Iterator.scala:371)
at org.neo4j.cypher.internal.ClosingIterator$$anonfun$hasNext$1.apply$mcZ$sp(ClosingIterator.scala:36)
at org.neo4j.cypher.internal.ClosingIterator$$anonfun$hasNext$1.apply(ClosingIterator.scala:35)
at org.neo4j.cypher.internal.ClosingIterator$$anonfun$hasNext$1.apply(ClosingIterator.scala:35)
at org.neo4j.cypher.internal.ClosingIterator.failIfThrows(ClosingIterator.scala:86)
at org.neo4j.cypher.internal.ClosingIterator.hasNext(ClosingIterator.scala:35)
at org.neo4j.cypher.PipeExecutionResult.hasNext(PipeExecutionResult.scala:157)
at scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:327)
at scala.collection.convert.Wrappers$IteratorWrapper.hasNext(Wrappers.scala:29)
at org.neo4j.cypher.PipeExecutionResult$$anon$1.hasNext(PipeExecutionResult.scala:73)
at Test.MAIN.fireQuery(MAIN.java:75)
at Test.MAIN.main(MAIN.java:60)
engine
在类的函数外声明,类型为ExecutionEngine
。
graphDB
在类外声明,类型为GraphDatabaseService
,并在调用函数fireQuery
之前引用对象
答案 0 :(得分:1)
这有点像类路径问题或其他线程可能尝试关闭graphdb,而迭代结果仍在进行中。请发布包含最新完整启动输出的graph.db/messages.log
尾部以进行进一步分析(可能不是内联,可能是在pastebin或其他工具上)。
请您使用groovy运行https://gist.github.com/sarmbruster/6658637并查看错误是否仍然存在?当然,请更改graphdb实例的路径。