spring-guides / gs-accessing-data-neo4j

Accessing Data with Neo4j :: Learn how to persist objects and relationships in Neo4j's NoSQL data store.
http://spring.io/guides/gs/accessing-data-neo4j/
Apache License 2.0
29 stars 49 forks source link

Exception while running the code with Neo4j 3.5.3 #48

Closed ranjith1235 closed 10 months ago

ranjith1235 commented 10 months ago

When I run the application I am getting the following exception. I am using Neo4j 3.5.3 docker container for testing this.

2023-12-19T09:21:19.645+05:30  INFO 88294 --- [           main] .s.b.a.l.ConditionEvaluationReportLogger : 

Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2023-12-19T09:21:19.663+05:30 ERROR 88294 --- [           main] o.s.boot.SpringApplication               : Application run failed

java.lang.IllegalStateException: Failed to execute CommandLineRunner
    at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:789) ~[spring-boot-3.2.0.jar:3.2.0]
    at org.springframework.boot.SpringApplication.lambda$callRunners$3(SpringApplication.java:770) ~[spring-boot-3.2.0.jar:3.2.0]
    at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183) ~[na:na]
    at java.base/java.util.stream.SortedOps$SizedRefSortingSink.end(SortedOps.java:357) ~[na:na]
    at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:510) ~[na:na]
    at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[na:na]
    at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) ~[na:na]
    at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) ~[na:na]
    at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na]
    at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596) ~[na:na]
    at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:765) ~[spring-boot-3.2.0.jar:3.2.0]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:330) ~[spring-boot-3.2.0.jar:3.2.0]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1342) ~[spring-boot-3.2.0.jar:3.2.0]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1331) ~[spring-boot-3.2.0.jar:3.2.0]
    at com.example.accessingdataneo4j.AccessingDataNeo4jApplication.main(AccessingDataNeo4jApplication.java:23) ~[main/:na]
Caused by: org.springframework.dao.NonTransientDataAccessResourceException: Expected 
RegularPlannerQuery(QueryGraph {Nodes: ['  rootNodeIds@7'], Predicates: ['id(`  rootNodeIds@7`) IN $rootNodeIds', '`  rootNodeIds@7`:Person']},InterestingOrder(List(),List()),AggregatingQueryProjection(Map(),Map(n -> FunctionInvocation(Namespace(List()),FunctionName(collect),false,Vector(Variable(  rootNodeIds@7)))),QueryShuffle(List(),None,None),Selections(Set())),Some(RegularPlannerQuery(QueryGraph {Arguments: ['n'], Optional Matches: : ['QueryGraph {Rels: ['(  UNNAMED114)--[relationshipIds]--(  UNNAMED135)'], Predicates: ['id(relationshipIds) IN $relationshipIds']}']},InterestingOrder(List(),List()),AggregatingQueryProjection(Map(n -> Variable(n)),Map(__sr__ -> FunctionInvocation(Namespace(List()),FunctionName(collect),true,Vector(Variable(relationshipIds)))),QueryShuffle(List(),None,None),Selections(Set())),Some(RegularPlannerQuery(QueryGraph {Arguments: ['__sr__', 'n'], Optional Matches: : ['QueryGraph {Nodes: ['relatedNodeIds'], Predicates: ['id(relatedNodeIds) IN $relatedNodeIds']}']},InterestingOrder(List(),List()),AggregatingQueryProjection(Map(n -> Variable(n), __sr__ -> Variable(__sr__)),Map(__srn__ -> FunctionInvocation(Namespace(List()),FunctionName(collect),true,Vector(Variable(relatedNodeIds)))),QueryShuffle(List(),None,None),Selections(Set())),Some(RegularPlannerQuery(QueryGraph {Arguments: ['__sr__', '__srn__', 'n']},InterestingOrder(List(),List()),UnwindProjection(  rootNodeIds@393,Variable(n)),Some(RegularPlannerQuery(QueryGraph {Arguments: ['  rootNodeIds@393', '__sr__', '__srn__', 'n']},InterestingOrder(List(),List()),RegularQueryProjection(Map(person -> Variable(  rootNodeIds@393), __sr__ -> Variable(__sr__), __srn__ -> Variable(__srn__)),QueryShuffle(List(),None,None),Selections(Set())),Some(RegularPlannerQuery(QueryGraph {Arguments: ['__sr__', '__srn__', 'person']},InterestingOrder(List(),List()),RegularQueryProjection(Map(__sn__ -> Variable(person), __sr__ -> Variable(__sr__), __srn__ -> Variable(__srn__)),QueryShuffle(List(),None,None),Selections(Set())),None))))))))))) 

Instead, got: 
RegularPlannerQuery(QueryGraph {Nodes: ['  rootNodeIds@7'], Predicates: ['`  rootNodeIds@7`:Person', 'id(`  rootNodeIds@7`) IN $rootNodeIds']},InterestingOrder(List(),List()),AggregatingQueryProjection(Map(),Map(n -> FunctionInvocation(Namespace(List()),FunctionName(collect),false,Vector(Variable(  rootNodeIds@7)))),QueryShuffle(List(),None,None),Selections(Set())),Some(RegularPlannerQuery(QueryGraph {Arguments: ['n'], Optional Matches: : ['QueryGraph {}']},InterestingOrder(List(),List()),AggregatingQueryProjection(Map(n -> Variable(n)),Map(__sr__ -> FunctionInvocation(Namespace(List()),FunctionName(collect),true,Vector(Variable(relationshipIds)))),QueryShuffle(List(),None,None),Selections(Set())),Some(RegularPlannerQuery(QueryGraph {Arguments: ['__sr__', 'n'], Optional Matches: : ['QueryGraph {Nodes: ['relatedNodeIds'], Predicates: ['id(relatedNodeIds) IN $relatedNodeIds']}']},InterestingOrder(List(),List()),AggregatingQueryProjection(Map(n -> Variable(n), __sr__ -> Variable(__sr__)),Map(__srn__ -> FunctionInvocation(Namespace(List()),FunctionName(collect),true,Vector(Variable(relatedNodeIds)))),QueryShuffle(List(),None,None),Selections(Set())),Some(RegularPlannerQuery(QueryGraph {Arguments: ['__sr__', '__srn__', 'n']},InterestingOrder(List(),List()),UnwindProjection(  rootNodeIds@393,Variable(n)),Some(RegularPlannerQuery(QueryGraph {Arguments: ['  rootNodeIds@393', '__sr__', '__srn__', 'n']},InterestingOrder(List(),List()),RegularQueryProjection(Map(person -> Variable(  rootNodeIds@393), __sr__ -> Variable(__sr__), __srn__ -> Variable(__srn__)),QueryShuffle(List(),None,None),Selections(Set())),Some(RegularPlannerQuery(QueryGraph {Arguments: ['__sr__', '__srn__', 'person']},InterestingOrder(List(),List()),RegularQueryProjection(Map(__sn__ -> Variable(person), __sr__ -> Variable(__sr__), __srn__ -> Variable(__srn__)),QueryShuffle(List(),None,None),Selections(Set())),None)))))))))))
Plan: Projection(Map(__sn__ -> Variable(person))) {
  LHS -> Apply() {
    LHS -> Projection(Map(person -> Variable(  rootNodeIds@393))) {
      LHS -> Apply() {
        LHS -> UnwindCollection(  rootNodeIds@393, Variable(n)) {
          LHS -> Apply() {
            LHS -> Aggregation(Map(n -> Variable(n), __sr__ -> Variable(__sr__)), Map(__srn__ -> FunctionInvocation(Namespace(List()),FunctionName(collect),true,Vector(Variable(relatedNodeIds))))) {
              LHS -> Apply() {
                LHS -> Aggregation(Map(n -> Variable(n)), Map(__sr__ -> FunctionInvocation(Namespace(List()),FunctionName(collect),true,Vector(Variable(relationshipIds))))) {
                  LHS -> Apply() {
                    LHS -> Aggregation(Map(), Map(n -> FunctionInvocation(Namespace(List()),FunctionName(collect),false,Vector(Variable(  rootNodeIds@7))))) {
                      LHS -> Selection(Ands(Set(In(FunctionInvocation(Namespace(List()),FunctionName(id),false,Vector(Variable(  rootNodeIds@7))),Parameter(rootNodeIds,Any))))) {
                        LHS -> NodeByLabelScan(  rootNodeIds@7, LabelName(Person), Set()) {}
                      }
                    }
                    RHS -> Apply() {
                      LHS -> Argument(Set(n)) {}
                      RHS -> Optional(Set(n)) {
                        LHS -> Argument(Set()) {}
                      }
                    }
                  }
                }
                RHS -> Apply() {
                  LHS -> Argument(Set(n, __sr__)) {}
                  RHS -> Optional(Set(n, __sr__)) {
                    LHS -> Selection(Ands(Set(In(FunctionInvocation(Namespace(List()),FunctionName(id),false,Vector(Variable(relatedNodeIds))),Parameter(relatedNodeIds,Any))))) {
                      LHS -> AllNodesScan(relatedNodeIds, Set()) {}
                    }
                  }
                }
              }
            }
            RHS -> Argument(Set(n, __sr__, __srn__)) {}
          }
        }
        RHS -> Argument(Set(n, __sr__, __srn__,   rootNodeIds@393)) {}
      }
    }
    RHS -> Argument(Set(person, __sr__, __srn__)) {}
  }
}; Error code Neo.DatabaseError.Statement.ExecutionFailed
ranjith1235 commented 10 months ago

Updating neo4j to latest version resolved the issue.