org.neo4j.cypher.ParameterNotFoundException: Expected a parameter named 1

Spring JIRA | Nghia Doan | 4 years ago
  1. 0

    Experiments show that when using FILTER, which contains expressions with named input parameters, then the input parameters are not recognized. It doesn't matter how we name the parameters: \{1\} or \{startPeriod\}. This query - collection filtering depending on other value - FAILED: {CODE} @Query(" START d=node:DepartmentCode(code={0}) MATCH d<-[:HAS_PROVINCE_LEVEL|HAS_DISTRICT_LEVEL|HAS_WARD_LEVEL]-l <-[:IN_PROVINCE|IN_DISTRICT|IN_WARD]-a<-[:HAS_COMPANY_ADDRESS]-c -[:HAS_BUSINESS_TYPE]->bt, c-[:HAS_COMPANY_LICENSE]->lc RETURN bt.name AS type, LENGTH(FILTER(v IN COLLECT(lc.validFrom) : v >= {1} AND v < {2})) AS numberOfNewLicenses, LENGTH(FILTER(v IN COLLECT(lc.validFrom) : v >= {3} AND v < {2})) AS numberOfTotalLicenses ") {CODE} This query - collection filtering depending on other distintive value - FAILED: {CODE} START d=node:DepartmentCode(code={0}) MATCH d<-[:HAS_PROVINCE_LEVEL|HAS_DISTRICT_LEVEL|HAS_WARD_LEVEL]-l<-[:IN_PROVINCE|IN_DISTRICT|IN_WARD]-a<-[:HAS_COMPANY_ADDRESS]-c-[:HAS_BUSINESS_TYPE]->bt, c-[:HAS_COMPANY_LICENSE]->lc WITH DISTINCT bt.name AS name, COLLECT(lc.validFrom) as lvc RETURN name, lvc AS newLicenseList, LENGTH(FILTER(l IN lvc : l >= {1} AND l < {2})) AS numberOfTotalLicenses") Iterable<LicenseInfo> getDepartmentLicenseInfo(String departmentCode, Long startPeriod, Long endPeriod {CODE} This query - collections based on a constant value - also FAILED: {CODE} START d=node:DepartmentCode(code={0}) MATCH d<-[:HAS_PROVINCE_LEVEL|HAS_DISTRICT_LEVEL|HAS_WARD_LEVEL]-l<-[:IN_PROVINCE|IN_DISTRICT|IN_WARD]-a<-[:HAS_COMPANY_ADDRESS]-c-[:HAS_BUSINESS_TYPE]->bt, c-[:HAS_COMPANY_LICENSE]->lc RETURN '' as name, COLLECT(lc.validFrom) AS newLicenseList, LENGTH(FILTER(l IN COLLECT(lc.validFrom) : l >= {1} AND l < {2})) AS numberOfTotalLicenses {CODE} This query - just filtering - also FAILED: {CODE} START d=node:DepartmentCode(code={0}) MATCH d<-[:HAS_PROVINCE_LEVEL|HAS_DISTRICT_LEVEL|HAS_WARD_LEVEL]-l<-[:IN_PROVINCE|IN_DISTRICT|IN_WARD]-a<-[:HAS_COMPANY_ADDRESS]-c-[:HAS_BUSINESS_TYPE]->bt, c-[:HAS_COMPANY_LICENSE]->lc RETURN LENGTH(FILTER(l IN COLLECT(lc.validFrom) : l >= {1} AND l < {2})) AS newLicenseList, LENGTH(FILTER(l IN COLLECT(lc.validFrom) : l >= {1} AND l < {2})) AS numberOfTotalLicenses {CODE} All failed with the same exception: {CODE} Exception in thread "main" org.neo4j.cypher.ParameterNotFoundException: Expected a parameter named 1 at org.neo4j.cypher.internal.commands.ParameterExpression$$anonfun$compute$3.apply(Expression.scala:262) at org.neo4j.cypher.internal.commands.ParameterExpression$$anonfun$compute$3.apply(Expression.scala:262) ... {CODE} (see my post) This works: {CODE} START d=node:DepartmentCode(code={0}) MATCH d<-[:HAS_PROVINCE_LEVEL|HAS_DISTRICT_LEVEL|HAS_WARD_LEVEL]-l<-[:IN_PROVINCE|IN_DISTRICT|IN_WARD]-a<-[:HAS_COMPANY_ADDRESS]-c-[:HAS_BUSINESS_TYPE]->bt, c-[:HAS_COMPANY_LICENSE]->lc WHERE lc.validFrom >= {1} AND lc.validFrom < {2} RETURN DISTINCT bt.name AS name, COLLECT(lc.validFrom) AS newLicenseList, COUNT(lc.validFrom) AS numberOfTotalLicenses {CODE} Extra work of course will be involved in order to filter the newLicenseList collection. My guess is that FILTER some how doesn't accept name parameters regardless how the collection is built.

    Spring JIRA | 4 years ago | Nghia Doan
    org.neo4j.cypher.ParameterNotFoundException: Expected a parameter named 1
  2. 0

    Experiments show that when using FILTER, which contains expressions with named input parameters, then the input parameters are not recognized. It doesn't matter how we name the parameters: \{1\} or \{startPeriod\}. This query - collection filtering depending on other value - FAILED: {CODE} @Query(" START d=node:DepartmentCode(code={0}) MATCH d<-[:HAS_PROVINCE_LEVEL|HAS_DISTRICT_LEVEL|HAS_WARD_LEVEL]-l <-[:IN_PROVINCE|IN_DISTRICT|IN_WARD]-a<-[:HAS_COMPANY_ADDRESS]-c -[:HAS_BUSINESS_TYPE]->bt, c-[:HAS_COMPANY_LICENSE]->lc RETURN bt.name AS type, LENGTH(FILTER(v IN COLLECT(lc.validFrom) : v >= {1} AND v < {2})) AS numberOfNewLicenses, LENGTH(FILTER(v IN COLLECT(lc.validFrom) : v >= {3} AND v < {2})) AS numberOfTotalLicenses ") {CODE} This query - collection filtering depending on other distintive value - FAILED: {CODE} START d=node:DepartmentCode(code={0}) MATCH d<-[:HAS_PROVINCE_LEVEL|HAS_DISTRICT_LEVEL|HAS_WARD_LEVEL]-l<-[:IN_PROVINCE|IN_DISTRICT|IN_WARD]-a<-[:HAS_COMPANY_ADDRESS]-c-[:HAS_BUSINESS_TYPE]->bt, c-[:HAS_COMPANY_LICENSE]->lc WITH DISTINCT bt.name AS name, COLLECT(lc.validFrom) as lvc RETURN name, lvc AS newLicenseList, LENGTH(FILTER(l IN lvc : l >= {1} AND l < {2})) AS numberOfTotalLicenses") Iterable<LicenseInfo> getDepartmentLicenseInfo(String departmentCode, Long startPeriod, Long endPeriod {CODE} This query - collections based on a constant value - also FAILED: {CODE} START d=node:DepartmentCode(code={0}) MATCH d<-[:HAS_PROVINCE_LEVEL|HAS_DISTRICT_LEVEL|HAS_WARD_LEVEL]-l<-[:IN_PROVINCE|IN_DISTRICT|IN_WARD]-a<-[:HAS_COMPANY_ADDRESS]-c-[:HAS_BUSINESS_TYPE]->bt, c-[:HAS_COMPANY_LICENSE]->lc RETURN '' as name, COLLECT(lc.validFrom) AS newLicenseList, LENGTH(FILTER(l IN COLLECT(lc.validFrom) : l >= {1} AND l < {2})) AS numberOfTotalLicenses {CODE} This query - just filtering - also FAILED: {CODE} START d=node:DepartmentCode(code={0}) MATCH d<-[:HAS_PROVINCE_LEVEL|HAS_DISTRICT_LEVEL|HAS_WARD_LEVEL]-l<-[:IN_PROVINCE|IN_DISTRICT|IN_WARD]-a<-[:HAS_COMPANY_ADDRESS]-c-[:HAS_BUSINESS_TYPE]->bt, c-[:HAS_COMPANY_LICENSE]->lc RETURN LENGTH(FILTER(l IN COLLECT(lc.validFrom) : l >= {1} AND l < {2})) AS newLicenseList, LENGTH(FILTER(l IN COLLECT(lc.validFrom) : l >= {1} AND l < {2})) AS numberOfTotalLicenses {CODE} All failed with the same exception: {CODE} Exception in thread "main" org.neo4j.cypher.ParameterNotFoundException: Expected a parameter named 1 at org.neo4j.cypher.internal.commands.ParameterExpression$$anonfun$compute$3.apply(Expression.scala:262) at org.neo4j.cypher.internal.commands.ParameterExpression$$anonfun$compute$3.apply(Expression.scala:262) ... {CODE} (see my post) This works: {CODE} START d=node:DepartmentCode(code={0}) MATCH d<-[:HAS_PROVINCE_LEVEL|HAS_DISTRICT_LEVEL|HAS_WARD_LEVEL]-l<-[:IN_PROVINCE|IN_DISTRICT|IN_WARD]-a<-[:HAS_COMPANY_ADDRESS]-c-[:HAS_BUSINESS_TYPE]->bt, c-[:HAS_COMPANY_LICENSE]->lc WHERE lc.validFrom >= {1} AND lc.validFrom < {2} RETURN DISTINCT bt.name AS name, COLLECT(lc.validFrom) AS newLicenseList, COUNT(lc.validFrom) AS numberOfTotalLicenses {CODE} Extra work of course will be involved in order to filter the newLicenseList collection. My guess is that FILTER some how doesn't accept name parameters regardless how the collection is built.

    Spring JIRA | 4 years ago | Nghia Doan
    org.neo4j.cypher.ParameterNotFoundException: Expected a parameter named 1
  3. 0

    Exercising a custom finder breaks with cryptic stack trace

    GitHub | 3 years ago | gregturn
    org.neo4j.cypher.ParameterNotFoundException: Expected a parameter named 0
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    The following repository does not work with '-parameters' compile flag of Java 8: {code} @Repository public interface UserRepository extends GraphRepository<User> { User findFirstByEmail(String email); } It leads to the following Stacktrace when using findFirstByEmail('<email here>'): org.neo4j.cypher.ParameterNotFoundException: Expected a parameter named 0 at org.neo4j.cypher.internal.compiler.v2_1.pipes.QueryState$$anonfun$getParam$1.apply(QueryState.scala:45) at org.neo4j.cypher.internal.compiler.v2_1.pipes.QueryState$$anonfun$getParam$1.apply(QueryState.scala:45) at scala.collection.MapLike$class.getOrElse(MapLike.scala:128) at scala.collection.AbstractMap.getOrElse(Map.scala:58) at org.neo4j.cypher.internal.compiler.v2_1.pipes.QueryState.getParam(QueryState.scala:45) at org.neo4j.cypher.internal.compiler.v2_1.commands.expressions.ParameterExpression.apply(ParameterExpression.scala:27) at org.neo4j.cypher.internal.compiler.v2_1.commands.Equals.isMatch(ComparablePredicate.scala:62) at org.neo4j.cypher.internal.compiler.v2_1.commands.Predicate.isTrue(Predicate.scala:33) at org.neo4j.cypher.internal.compiler.v2_1.pipes.FilterPipe$$anonfun$internalCreateResults$1.apply(FilterPipe.scala:31) at org.neo4j.cypher.internal.compiler.v2_1.pipes.FilterPipe$$anonfun$internalCreateResults$1.apply(FilterPipe.scala:31) at scala.collection.Iterator$$anon$14.hasNext(Iterator.scala:390) at scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:327) at scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:327) at org.neo4j.cypher.internal.compiler.v2_1.ClosingIterator$$anonfun$hasNext$1.apply$mcZ$sp(ClosingIterator.scala:37) at org.neo4j.cypher.internal.compiler.v2_1.ClosingIterator$$anonfun$hasNext$1.apply(ClosingIterator.scala:34) at org.neo4j.cypher.internal.compiler.v2_1.ClosingIterator$$anonfun$hasNext$1.apply(ClosingIterator.scala:34) at org.neo4j.cypher.internal.compiler.v2_1.ClosingIterator$$anonfun$failIfThrows$1.apply(ClosingIterator.scala:93) at org.neo4j.cypher.internal.compiler.v2_1.ClosingIterator.decoratedCypherException(ClosingIterator.scala:102) at org.neo4j.cypher.internal.compiler.v2_1.ClosingIterator.failIfThrows(ClosingIterator.scala:91) at org.neo4j.cypher.internal.compiler.v2_1.ClosingIterator.hasNext(ClosingIterator.scala:34) at org.neo4j.cypher.internal.compiler.v2_1.PipeExecutionResult.hasNext(PipeExecutionResult.scala:166) at scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:327) at scala.collection.convert.Wrappers$IteratorWrapper.hasNext(Wrappers.scala:29) at org.neo4j.cypher.internal.compiler.v2_1.PipeExecutionResult$$anon$1.hasNext(PipeExecutionResult.scala:74) at org.neo4j.helpers.collection.IteratorWrapper.hasNext(IteratorWrapper.java:42) at org.neo4j.helpers.collection.IteratorUtil.single(IteratorUtil.java:335) at org.neo4j.helpers.collection.IteratorUtil.singleOrNull(IteratorUtil.java:128) at org.neo4j.helpers.collection.IteratorUtil.singleOrNull(IteratorUtil.java:286) at org.springframework.data.neo4j.conversion.QueryResultBuilder.singleOrNull(QueryResultBuilder.java:71) at org.springframework.data.neo4j.repository.query.GraphRepositoryQuery.dispatchQuery(GraphRepositoryQuery.java:117) at org.springframework.data.neo4j.repository.query.GraphRepositoryQuery$1.doWithGraph(GraphRepositoryQuery.java:88) at org.springframework.data.neo4j.support.Neo4jTemplate.doExecute(Neo4jTemplate.java:456) at org.springframework.data.neo4j.support.Neo4jTemplate.access$000(Neo4jTemplate.java:86) at org.springframework.data.neo4j.support.Neo4jTemplate$2.doInTransaction(Neo4jTemplate.java:470) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) at org.springframework.data.neo4j.support.Neo4jTemplate.exec(Neo4jTemplate.java:467) at org.springframework.data.neo4j.repository.query.GraphRepositoryQuery.execute(GraphRepositoryQuery.java:82) at org.springframework.data.neo4j.repository.query.DerivedCypherRepositoryQuery.execute(DerivedCypherRepositoryQuery.java:39) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:384) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:344) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207) at com.sun.proxy.$Proxy92.findFirstByEmail(Unknown Source) at org.dosenmucke.business.user.entity.constraint.UniqueEmailValidator.isValid(UniqueEmailValidator.java:28) at org.dosenmucke.business.user.entity.constraint.UniqueEmailValidator.isValid(UniqueEmailValidator.java:16) at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateSingleConstraint(ConstraintTree.java:281) at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateConstraints(ConstraintTree.java:133) at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateConstraints(ConstraintTree.java:91) at org.hibernate.validator.internal.metadata.core.MetaConstraint.validateConstraint(MetaConstraint.java:85) at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraint(ValidatorImpl.java:478) at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForDefaultGroup(ValidatorImpl.java:424) at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForCurrentGroup(ValidatorImpl.java:388) at org.hibernate.validator.internal.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:340) at org.hibernate.validator.internal.engine.ValidatorImpl.validate(ValidatorImpl.java:158) at org.springframework.validation.beanvalidation.SpringValidatorAdapter.validate(SpringValidatorAdapter.java:207) at org.dosenmucke.Application$1.onApplicationEvent(Application.java:63) at org.dosenmucke.Application$1.onApplicationEvent(Application.java:59) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:98) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:333) at org.springframework.data.neo4j.support.Neo4jTemplate.save(Neo4jTemplate.java:355) at org.springframework.data.neo4j.support.Neo4jTemplate.save(Neo4jTemplate.java:350) at org.springframework.data.neo4j.repository.AbstractGraphRepository.save(AbstractGraphRepository.java:91) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:405) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:390) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:344) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207) at com.sun.proxy.$Proxy92.save(Unknown Source) at org.dosenmucke.business.user.boundary.AdminUserServiceBean.create(AdminUserServiceBean.java:33) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) at org.springframework.validation.beanvalidation.MethodValidationInterceptor.invoke(MethodValidationInterceptor.java:122) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207) at com.sun.proxy.$Proxy94.create(Unknown Source) at org.dosenmucke.adapter.rest.user.AdminUserRestController.create(AdminUserRestController.java:36) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:749) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:689) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:938) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:863) at javax.servlet.http.HttpServlet.service(HttpServlet.java:646) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1736) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1695) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745) {code} However, if the parameter is annotated with @Param("0") it works again: {code} @Repository public interface UserRepository extends GraphRepository<User> { User findFirstByEmail(@Param("0") String email); } {code}

    Spring JIRA | 2 years ago | American McGee
    org.neo4j.cypher.ParameterNotFoundException: Expected a parameter named 0
  6. 0

    The following repository does not work with '-parameters' compile flag of Java 8: {code} @Repository public interface UserRepository extends GraphRepository<User> { User findFirstByEmail(String email); } It leads to the following Stacktrace when using findFirstByEmail('<email here>'): org.neo4j.cypher.ParameterNotFoundException: Expected a parameter named 0 at org.neo4j.cypher.internal.compiler.v2_1.pipes.QueryState$$anonfun$getParam$1.apply(QueryState.scala:45) at org.neo4j.cypher.internal.compiler.v2_1.pipes.QueryState$$anonfun$getParam$1.apply(QueryState.scala:45) at scala.collection.MapLike$class.getOrElse(MapLike.scala:128) at scala.collection.AbstractMap.getOrElse(Map.scala:58) at org.neo4j.cypher.internal.compiler.v2_1.pipes.QueryState.getParam(QueryState.scala:45) at org.neo4j.cypher.internal.compiler.v2_1.commands.expressions.ParameterExpression.apply(ParameterExpression.scala:27) at org.neo4j.cypher.internal.compiler.v2_1.commands.Equals.isMatch(ComparablePredicate.scala:62) at org.neo4j.cypher.internal.compiler.v2_1.commands.Predicate.isTrue(Predicate.scala:33) at org.neo4j.cypher.internal.compiler.v2_1.pipes.FilterPipe$$anonfun$internalCreateResults$1.apply(FilterPipe.scala:31) at org.neo4j.cypher.internal.compiler.v2_1.pipes.FilterPipe$$anonfun$internalCreateResults$1.apply(FilterPipe.scala:31) at scala.collection.Iterator$$anon$14.hasNext(Iterator.scala:390) at scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:327) at scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:327) at org.neo4j.cypher.internal.compiler.v2_1.ClosingIterator$$anonfun$hasNext$1.apply$mcZ$sp(ClosingIterator.scala:37) at org.neo4j.cypher.internal.compiler.v2_1.ClosingIterator$$anonfun$hasNext$1.apply(ClosingIterator.scala:34) at org.neo4j.cypher.internal.compiler.v2_1.ClosingIterator$$anonfun$hasNext$1.apply(ClosingIterator.scala:34) at org.neo4j.cypher.internal.compiler.v2_1.ClosingIterator$$anonfun$failIfThrows$1.apply(ClosingIterator.scala:93) at org.neo4j.cypher.internal.compiler.v2_1.ClosingIterator.decoratedCypherException(ClosingIterator.scala:102) at org.neo4j.cypher.internal.compiler.v2_1.ClosingIterator.failIfThrows(ClosingIterator.scala:91) at org.neo4j.cypher.internal.compiler.v2_1.ClosingIterator.hasNext(ClosingIterator.scala:34) at org.neo4j.cypher.internal.compiler.v2_1.PipeExecutionResult.hasNext(PipeExecutionResult.scala:166) at scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:327) at scala.collection.convert.Wrappers$IteratorWrapper.hasNext(Wrappers.scala:29) at org.neo4j.cypher.internal.compiler.v2_1.PipeExecutionResult$$anon$1.hasNext(PipeExecutionResult.scala:74) at org.neo4j.helpers.collection.IteratorWrapper.hasNext(IteratorWrapper.java:42) at org.neo4j.helpers.collection.IteratorUtil.single(IteratorUtil.java:335) at org.neo4j.helpers.collection.IteratorUtil.singleOrNull(IteratorUtil.java:128) at org.neo4j.helpers.collection.IteratorUtil.singleOrNull(IteratorUtil.java:286) at org.springframework.data.neo4j.conversion.QueryResultBuilder.singleOrNull(QueryResultBuilder.java:71) at org.springframework.data.neo4j.repository.query.GraphRepositoryQuery.dispatchQuery(GraphRepositoryQuery.java:117) at org.springframework.data.neo4j.repository.query.GraphRepositoryQuery$1.doWithGraph(GraphRepositoryQuery.java:88) at org.springframework.data.neo4j.support.Neo4jTemplate.doExecute(Neo4jTemplate.java:456) at org.springframework.data.neo4j.support.Neo4jTemplate.access$000(Neo4jTemplate.java:86) at org.springframework.data.neo4j.support.Neo4jTemplate$2.doInTransaction(Neo4jTemplate.java:470) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) at org.springframework.data.neo4j.support.Neo4jTemplate.exec(Neo4jTemplate.java:467) at org.springframework.data.neo4j.repository.query.GraphRepositoryQuery.execute(GraphRepositoryQuery.java:82) at org.springframework.data.neo4j.repository.query.DerivedCypherRepositoryQuery.execute(DerivedCypherRepositoryQuery.java:39) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:384) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:344) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207) at com.sun.proxy.$Proxy92.findFirstByEmail(Unknown Source) at org.dosenmucke.business.user.entity.constraint.UniqueEmailValidator.isValid(UniqueEmailValidator.java:28) at org.dosenmucke.business.user.entity.constraint.UniqueEmailValidator.isValid(UniqueEmailValidator.java:16) at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateSingleConstraint(ConstraintTree.java:281) at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateConstraints(ConstraintTree.java:133) at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateConstraints(ConstraintTree.java:91) at org.hibernate.validator.internal.metadata.core.MetaConstraint.validateConstraint(MetaConstraint.java:85) at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraint(ValidatorImpl.java:478) at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForDefaultGroup(ValidatorImpl.java:424) at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForCurrentGroup(ValidatorImpl.java:388) at org.hibernate.validator.internal.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:340) at org.hibernate.validator.internal.engine.ValidatorImpl.validate(ValidatorImpl.java:158) at org.springframework.validation.beanvalidation.SpringValidatorAdapter.validate(SpringValidatorAdapter.java:207) at org.dosenmucke.Application$1.onApplicationEvent(Application.java:63) at org.dosenmucke.Application$1.onApplicationEvent(Application.java:59) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:98) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:333) at org.springframework.data.neo4j.support.Neo4jTemplate.save(Neo4jTemplate.java:355) at org.springframework.data.neo4j.support.Neo4jTemplate.save(Neo4jTemplate.java:350) at org.springframework.data.neo4j.repository.AbstractGraphRepository.save(AbstractGraphRepository.java:91) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:405) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:390) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:344) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207) at com.sun.proxy.$Proxy92.save(Unknown Source) at org.dosenmucke.business.user.boundary.AdminUserServiceBean.create(AdminUserServiceBean.java:33) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) at org.springframework.validation.beanvalidation.MethodValidationInterceptor.invoke(MethodValidationInterceptor.java:122) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207) at com.sun.proxy.$Proxy94.create(Unknown Source) at org.dosenmucke.adapter.rest.user.AdminUserRestController.create(AdminUserRestController.java:36) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:749) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:689) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:938) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:863) at javax.servlet.http.HttpServlet.service(HttpServlet.java:646) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1736) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1695) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745) {code} However, if the parameter is annotated with @Param("0") it works again: {code} @Repository public interface UserRepository extends GraphRepository<User> { User findFirstByEmail(@Param("0") String email); } {code}

    Spring JIRA | 2 years ago | American McGee
    org.neo4j.cypher.ParameterNotFoundException: Expected a parameter named 0

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.neo4j.cypher.ParameterNotFoundException

      Expected a parameter named 1

      at org.neo4j.cypher.internal.commands.ParameterExpression$$anonfun$compute$3.apply()
    2. org.neo4j.cypher
      ParameterExpression$$anonfun$compute$3.apply
      1. org.neo4j.cypher.internal.commands.ParameterExpression$$anonfun$compute$3.apply(Expression.scala:262)
      2. org.neo4j.cypher.internal.commands.ParameterExpression$$anonfun$compute$3.apply(Expression.scala:262)
      2 frames