Hello Chris,

FindShortestPaths is in its own transaction try-block. See code below. It 
doesn't flag an exception and when you print the query result as a string 
you see complete paths are retired to the query is working/returning 
successfully.


Has anything between versions changed concerning transactions like this?
Anything I can do to debug more? The stack trace is below in red.

Regards, John.


    private static Iterator<Path> 
findShortestPathsCypher(GraphDatabaseService db, String sa, String sb) {

    Result result = null;

    Iterator<Path> paths = null;

    try ( Transaction tx = db.beginTx() )  {

result = db.execute("" +

"MATCH (a:Page { title: '" + sa + "' }) " +

"MATCH (b:Page { title: '" + sb + "' }) " +

    "MATCH p=allshortestpaths((a)-[*..10]->(b)) " +

"return p;");

/*result = db.execute("" +

"START p=node(9178091) " +  

"return p;");        

*/

paths = result.columnAs("p"); 

tx.success();

tx.close();

}

catch (Exception e) {

System.out.println("Exception on shortest path Cypher query: "  + e
.getMessage());

}

    return paths;

}



Exception on path expansion: org.neo4j.graphdb.NotInTransactionException: 
The statement has been closed.
org.neo4j.graphdb.NotInTransactionException: The statement has been closed.
at 
org.neo4j.kernel.impl.api.KernelStatement.assertOpen(KernelStatement.java:127)
at 
org.neo4j.kernel.impl.api.OperationsFacade.nodesGetFromIndexSeek(OperationsFacade.java:184)
at 
org.neo4j.cypher.internal.spi.v2_3.TransactionBoundQueryContext.indexSeek(TransactionBoundQueryContext.scala:151)
at 
org.neo4j.cypher.internal.compiler.v2_3.spi.DelegatingQueryContext.indexSeek(DelegatingQueryContext.scala:88)
at 
org.neo4j.cypher.internal.compatibility.ExceptionTranslatingQueryContextFor2_3.org$neo4j$cypher$internal$compatibility$ExceptionTranslatingQueryContextFor2_3$$super$indexSeek(ExceptionTranslatingQueryContextFor2_3.scala:95)
at 
org.neo4j.cypher.internal.compatibility.ExceptionTranslatingQueryContextFor2_3$$anonfun$indexSeek$1.apply(ExceptionTranslatingQueryContextFor2_3.scala:95)
at 
org.neo4j.cypher.internal.compatibility.ExceptionTranslatingQueryContextFor2_3$$anonfun$indexSeek$1.apply(ExceptionTranslatingQueryContextFor2_3.scala:95)
at 
org.neo4j.cypher.internal.compatibility.ExceptionTranslatingQueryContextFor2_3.org$neo4j$cypher$internal$compatibility$ExceptionTranslatingQueryContextFor2_3$$translateException(ExceptionTranslatingQueryContextFor2_3.scala:197)
at 
org.neo4j.cypher.internal.compatibility.ExceptionTranslatingQueryContextFor2_3.indexSeek(ExceptionTranslatingQueryContextFor2_3.scala:95)
at 
org.neo4j.cypher.internal.compiler.v2_3.pipes.IndexSeek$$anonfun$indexFactory$1$$anonfun$apply$1.apply(IndexSeekMode.scala:43)
at 
org.neo4j.cypher.internal.compiler.v2_3.pipes.IndexSeek$$anonfun$indexFactory$1$$anonfun$apply$1.apply(IndexSeekMode.scala:43)
at 
org.neo4j.cypher.internal.compiler.v2_3.commands.indexQuery$.org$neo4j$cypher$internal$compiler$v2_3$commands$indexQuery$$lookupNodes(indexQuery.scala:68)
at 
org.neo4j.cypher.internal.compiler.v2_3.commands.indexQuery$.apply(indexQuery.scala:41)
at 
org.neo4j.cypher.internal.compiler.v2_3.pipes.NodeIndexSeekPipe.internalCreateResults(NodeIndexSeekPipe.scala:52)
at 
org.neo4j.cypher.internal.compiler.v2_3.pipes.Pipe$class.createResults(Pipe.scala:58)
at 
org.neo4j.cypher.internal.compiler.v2_3.pipes.NodeIndexSeekPipe.createResults(NodeIndexSeekPipe.scala:34)
at 
org.neo4j.cypher.internal.compiler.v2_3.pipes.CartesianProductPipe$$anonfun$internalCreateResults$1.apply(CartesianProductPipe.scala:39)
at 
org.neo4j.cypher.internal.compiler.v2_3.pipes.CartesianProductPipe$$anonfun$internalCreateResults$1.apply(CartesianProductPipe.scala:38)
at scala.collection.Iterator$$anon$12.hasNext(Iterator.scala:396)
at 
org.neo4j.cypher.internal.compiler.v2_3.pipes.Pipe$$anon$1.hasNext(Pipe.scala:60)
at scala.collection.Iterator$$anon$12.hasNext(Iterator.scala:396)
at scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:369)
at 
org.neo4j.cypher.internal.compiler.v2_3.ClosingIterator$$anonfun$hasNext$1.apply$mcZ$sp(ResultIterator.scala:62)
at 
org.neo4j.cypher.internal.compiler.v2_3.ClosingIterator$$anonfun$hasNext$1.apply(ResultIterator.scala:61)
at 
org.neo4j.cypher.internal.compiler.v2_3.ClosingIterator$$anonfun$hasNext$1.apply(ResultIterator.scala:61)
at 
org.neo4j.cypher.internal.compiler.v2_3.ClosingIterator$$anonfun$failIfThrows$1.apply(ResultIterator.scala:121)
at 
org.neo4j.cypher.internal.compiler.v2_3.ClosingIterator.decoratedCypherException(ResultIterator.scala:130)
at 
org.neo4j.cypher.internal.compiler.v2_3.ClosingIterator.failIfThrows(ResultIterator.scala:119)
at 
org.neo4j.cypher.internal.compiler.v2_3.ClosingIterator.hasNext(ResultIterator.scala:60)
at 
org.neo4j.cypher.internal.compiler.v2_3.PipeExecutionResult.hasNext(PipeExecutionResult.scala:75)
at 
org.neo4j.cypher.internal.compiler.v2_3.PipeExecutionResult$$anon$1.hasNext(PipeExecutionResult.scala:60)
at 
org.neo4j.cypher.javacompat.ExecutionResult$ExceptionConversion.hasNext(ExecutionResult.java:354)







On Tuesday, November 24, 2015 at 3:11:29 AM UTC-8, Chris Vest wrote:
>
> Try moving the findShortestPathsCypher call inside the try-block that 
> contains the transaction.
>
> --
> Chris Vest
> System Engineer, Neo Technology
> [ skype: mr.chrisvest, twitter: chvest ]
>
>
> On 24 Nov 2015, at 08:32, Fry <[email protected] <javascript:>> wrote:
>
>
> Hi All,
>
> for the code below it works on one system and not another. The differences 
> are:
>
>    - Working system: OS X - neo4j-community-2.2.5
>    - Broken system: Ubuntu - neo4j-communty-2.3.0
>
> The code in red return returns an exception 
> *"org.neo4j.grapg.db.NotInTransactionException: 
> The statement has been closed."*
>
> Has any one any experience with this of can offer advice/clues?
>
> Many thanks, John.
>
>
>
> Iterator<Path> paths;
>
> paths = findShortestPathsCypher(db, icString[i], icString[j]);
>
>
> *try ( Transaction tx = db.beginTx() ) {*
>
> *    while (paths.hasNext()){*
>
>     Path path = (Path) paths.next();
>
>     Iterable<Node> nodes = path.nodes();
>
>     java.util.Iterator<Node> nodeIterator = nodes.iterator();
>
>     ShortestPath.clear(); 
>
>     System.out.println(" ");
>
>     boolean first = true;
>
>     while (nodeIterator.hasNext()){
>
>         Node n = nodeIterator.next();
>
>         String nodeName = (String) n.getProperty("title");
>
>     ShortestPath.add(nodeName);
>
>     if (first) {
>
>         System.out.print("Path: " + nodeName);
>
>             first = false;
>
>     } else
>
>         System.out.print(" ->- " + nodeName);
>
>     }
>
>     AllShortestPaths.add((ArrayList<String>)ShortestPath.clone());
>
>     }
>
> } catch (Exception e) {
>
>     System.out.println("Exception on path expansion: " + e.toString());
>
>     e.printStackTrace();
>
> }
>             
>
>
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Neo4j" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] <javascript:>.
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to