我有NodeJS项目,我正在使用neo4j库版本^2.0.0-RC2
执行Neo4j Cypher查询。我有一个查询,如果在Node Application中运行会给出下面的错误堆栈,但是如果我在浏览器控制台中运行相同的查询,它会返回正常。
[neo4j.DatabaseError: [Neo.DatabaseError.Statement.ExecutionFailure] java.lang.NullPointerException
at org.neo4j.cypher.internal.compiler.v2_3.pipes.NiceHasherValue.equals(NiceHasher.scala:70)
at scala.collection.mutable.FlatHashTable$class.findElemImpl(FlatHashTable.scala:128)
at scala.collection.mutable.FlatHashTable$class.containsElem(FlatHashTable.scala:121)
at scala.collection.mutable.HashSet.containsElem(HashSet.scala:40)
at scala.collection.mutable.HashSet.contains(HashSet.scala:57)
at org.neo4j.cypher.internal.compiler.v2_3.pipes.aggregation.DistinctFunction.apply(DistinctFunction.scala:38)
at org.neo4j.cypher.internal.compiler.v2_3.pipes.EagerAggregationPipe$$anonfun$internalCreateResults$1$$anonfun$apply$1.apply(EagerAggregationPipe.scala:84)
at org.neo4j.cypher.internal.compiler.v2_3.pipes.EagerAggregationPipe$$anonfun$internalCreateResults$1$$anonfun$apply$1.apply(EagerAggregationPipe.scala:84)
at scala.collection.immutable.List.foreach(List.scala:381)
at org.neo4j.cypher.internal.compiler.v2_3.pipes.EagerAggregationPipe$$anonfun$internalCreateResults$1.apply(EagerAggregationPipe.scala:84)
at org.neo4j.cypher.internal.compiler.v2_3.pipes.EagerAggregationPipe$$anonfun$internalCreateResults$1.apply(EagerAggregationPipe.scala:80)
at scala.collection.Iterator$class.foreach(Iterator.scala:742)
at scala.collection.AbstractIterator.foreach(Iterator.scala:1194)
at org.neo4j.cypher.internal.compiler.v2_3.pipes.EagerAggregationPipe.internalCreateResults(EagerAggregationPipe.scala:80)
at org.neo4j.cypher.internal.compiler.v2_3.pipes.PipeWithSource.createResults(Pipe.scala:125)
at org.neo4j.cypher.internal.compiler.v2_3.pipes.PipeWithSource.createResults(Pipe.scala:122)
at org.neo4j.cypher.internal.compiler.v2_3.executionplan.DefaultExecutionResultBuilderFactory$ExecutionWorkflowBuilder.createResults(DefaultExecutionResultBuilderFactory.scala:93)
at org.neo4j.cypher.internal.compiler.v2_3.executionplan.DefaultExecutionResultBuilderFactory$ExecutionWorkflowBuilder.build(DefaultExecutionResultBuilderFactory.scala:63)
at org.neo4j.cypher.internal.compiler.v2_3.executionplan.ExecutionPlanBuilder$$anonfun$getExecutionPlanFunction$1.apply(ExecutionPlanBuilder.scala:223)
at org.neo4j.cypher.internal.compiler.v2_3.executionplan.ExecutionPlanBuilder$$anonfun$getExecutionPlanFunction$1.apply(ExecutionPlanBuilder.scala:207)
at org.neo4j.cypher.internal.compiler.v2_3.executionplan.ExecutionPlanBuilder$$anon$2.run(ExecutionPlanBuilder.scala:164)
at org.neo4j.cypher.internal.compatibility.CompatibilityFor2_3$ExecutionPlanWrapper$$anonfun$run$1.apply(CompatibilityFor2_3.scala:200)
at org.neo4j.cypher.internal.compatibility.CompatibilityFor2_3$ExecutionPlanWrapper$$anonfun$run$1.apply(CompatibilityFor2_3.scala:200)
at org.neo4j.cypher.internal.compatibility.exceptionHandlerFor2_3$.runSafely(CompatibilityFor2_3.scala:116)
at org.neo4j.cypher.internal.compatibility.CompatibilityFor2_3$ExecutionPlanWrapper.run(CompatibilityFor2_3.scala:199)
at org.neo4j.cypher.internal.PreparedPlanExecution.execute(PreparedPlanExecution.scala:27)
at org.neo4j.cypher.ExecutionEngine.execute(ExecutionEngine.scala:120)
at org.neo4j.cypher.ExecutionEngine.execute(ExecutionEngine.scala:114)
at org.neo4j.cypher.javacompat.internal.ServerExecutionEngine.executeQuery(ServerExecutionEngine.java:62)
at org.neo4j.server.rest.transactional.TransactionHandle.executeStatements(TransactionHandle.java:328)
at org.neo4j.server.rest.transactional.TransactionHandle.commit(TransactionHandle.java:147)
at org.neo4j.server.rest.web.TransactionalService$2.write(TransactionalService.java:211)
at com.sun.jersey.core.impl.provider.entity.StreamingOutputProvider.writeTo(StreamingOutputProvider.java:71)
at com.sun.jersey.core.impl.provider.entity.StreamingOutputProvider.writeTo(StreamingOutputProvider.java:57)
at com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:302)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1510)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1419)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1409)
at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:409)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:558)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:733)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:808)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)
at org.neo4j.server.rest.dbms.AuthorizationFilter.doFilter(AuthorizationFilter.java:116)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
at org.neo4j.server.rest.web.CollectUserAgentFilter.doFilter(CollectUserAgentFilter.java:69)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
at org.eclipse.jetty.server.Server.handle(Server.java:497)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
at java.lang.Thread.run(Thread.java:745)
]
使用Javascript stacktrace如下:
at Function.__dirname.Error.Error._fromObject (/home/savitoj/Work/mercureup/node_modules/neo4j/lib-new/errors.js:70:14)
at /home/savitoj/Work/mercureup/node_modules/neo4j/lib-new/GraphDatabase.js:299:25
at Request._callback (/home/savitoj/Work/mercureup/node_modules/neo4j/lib-new/GraphDatabase.js:92:20)
at Request.self.callback (/home/savitoj/Work/mercureup/node_modules/request/request.js:198:22)
at emitTwo (events.js:100:13)
at Request.emit (events.js:185:7)
at Request.<anonymous> (/home/savitoj/Work/mercureup/node_modules/request/request.js:1035:10)
at emitOne (events.js:95:20)
at Request.emit (events.js:182:7)
at IncomingMessage.<anonymous> (/home/savitoj/Work/mercureup/node_modules/request/request.js:962:12)
at emitNone (events.js:85:20)
at IncomingMessage.emit (events.js:179:7)
at endReadableNT (_stream_readable.js:906:12)
at nextTickCallbackWith2Args (node.js:475:9)
at process._tickCallback (node.js:389:17)
我的查询如下
MATCH (place:Place)<-[:IN]-(event:Event {id:'29_jun_2'})-[]-(chat:Chat), (user:User {id: 'NJE86-jRe'})
OPTIONAL MATCH (event)-[:CHKIN]-(friendchkin:User)-[:FRIEND]-(user)
WHERE NOT (friendchkin)-[:BLOCK]->(user)
return event, chat, user, COLLECT(distinct friendchkin) AS friendschkin;
当我在OPTIONAL MATCH
之后注释掉该部分时,查询工作正常,但又包含了错误。在浏览器控制台中,我按预期获得事件,聊天,用户,COLLECT
返回一个空数组。
还会提到在运行NodeJS应用程序时Neo4j控制台中显示No Error堆栈跟踪,错误仅显示在NodeJS Server终端上。