Cypher query throws exception in SDN

137 views
Skip to first unread message

Abdul Azeez Shaik

unread,
Oct 6, 2012, 6:32:47 AM10/6/12
to ne...@googlegroups.com
Hi,

The following cypher query which runs successfully on web console, throws error when i run it through SDN, Could you please let me know what could be the error here?

START category=node:productline("productline:WOMENS_RTW") WITH collect(category) as categories START user=node:search("username:*a* OR name:*a*") WHERE ALL( c in categories WHERE user-[:has_category]->c) RETURN user

Here is my query on repository,

@Query( "START category=node:productline({0}) WITH collect(category) as categories" +

"START user=node:search({1}) +

"WHERE ALL( c in categories WHERE user-[:has_category]->c) RETURN user")

Iterable<User> doAdvancedSearch(String Categories, String search);



Here are the parameters those are passed,
username:*a* OR name:*a*
productline:*

These are versions i have included in pom,
     <spring-data-neo4j.version>2.1.0.RC4</spring-data-neo4j.version>
    <org.jackson-version>1.9.7</org.jackson-version>
<neo4j.version>1.8.RC1</neo4j.version>


Here is the exception,

Oct 6, 2012 3:22:22 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [dispatcher] in context with path [] threw exception [Request processing failed; nested exception is org.neo4j.rest.graphdb.RestResultException: Expected a parameter named 1 at
BadInputException
   org.neo4j.server.rest.repr.RepresentationExceptionHandlingIterable.exceptionOnHasNext(RepresentationExceptionHandlingIterable.java:51)
   org.neo4j.helpers.collection.ExceptionHandlingIterable$1.hasNext(ExceptionHandlingIterable.java:61)
   org.neo4j.helpers.collection.IteratorWrapper.hasNext(IteratorWrapper.java:42)
   org.neo4j.server.rest.repr.ListRepresentation.serialize(ListRepresentation.java:58)
   org.neo4j.server.rest.repr.Serializer.serialize(Serializer.java:75)
   org.neo4j.server.rest.repr.MappingSerializer.putList(MappingSerializer.java:61)
   org.neo4j.server.rest.repr.CypherResultRepresentation.serialize(CypherResultRepresentation.java:50)
   org.neo4j.server.rest.repr.MappingRepresentation.serialize(MappingRepresentation.java:42)
   org.neo4j.server.rest.repr.OutputFormat$1.write(OutputFormat.java:133)
] with root cause
org.neo4j.rest.graphdb.RestResultException: Expected a parameter named 1 at
BadInputException
   org.neo4j.server.rest.repr.RepresentationExceptionHandlingIterable.exceptionOnHasNext(RepresentationExceptionHandlingIterable.java:51)
   org.neo4j.helpers.collection.ExceptionHandlingIterable$1.hasNext(ExceptionHandlingIterable.java:61)
   org.neo4j.helpers.collection.IteratorWrapper.hasNext(IteratorWrapper.java:42)
   org.neo4j.server.rest.repr.ListRepresentation.serialize(ListRepresentation.java:58)
   org.neo4j.server.rest.repr.Serializer.serialize(Serializer.java:75)
   org.neo4j.server.rest.repr.MappingSerializer.putList(MappingSerializer.java:61)
   org.neo4j.server.rest.repr.CypherResultRepresentation.serialize(CypherResultRepresentation.java:50)
   org.neo4j.server.rest.repr.MappingRepresentation.serialize(MappingRepresentation.java:42)
   org.neo4j.server.rest.repr.OutputFormat$1.write(OutputFormat.java:133)

at org.neo4j.rest.graphdb.ExecutingRestAPI.query(ExecutingRestAPI.java:488)
at org.neo4j.rest.graphdb.RestAPIFacade.query(RestAPIFacade.java:233)
at org.neo4j.rest.graphdb.query.RestCypherQueryEngine.query(RestCypherQueryEngine.java:50)
at org.springframework.data.neo4j.rest.SpringRestCypherQueryEngine.query(SpringRestCypherQueryEngine.java:41)
at org.springframework.data.neo4j.rest.SpringRestCypherQueryEngine.query(SpringRestCypherQueryEngine.java:27)
at org.springframework.data.neo4j.repository.query.GraphRepositoryQuery.dispatchQuery(GraphRepositoryQuery.java:101)
at org.springframework.data.neo4j.repository.query.GraphRepositoryQuery.execute(GraphRepositoryQuery.java:80)
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:313)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:155)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy36.doAdvancedSearch(Unknown Source)
at org.netvogue.server.neo4japi.service.UserServiceImpl.doAdvancedSearch(UserServiceImpl.java:86)
at org.netvogue.server.webmvc.controllers.SearchController.doAdvancedSearch(SearchController.java:84)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:213)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:617)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.netvogue.server.webmvc.filter.CaptchaVerifierFilter.doFilterInternal(CaptchaVerifierFilter.java:97)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:183)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.netvogue.server.webmvc.filter.CaptchaCaptureFilter.doFilterInternal(CaptchaCaptureFilter.java:43)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:964)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)

Abdul Azeez Shaik

unread,
Oct 6, 2012, 11:36:03 AM10/6/12
to ne...@googlegroups.com
Any pointers on this exception? Could't think of anything, as both the parameters are being passed correctly

Michael Hunger

unread,
Oct 6, 2012, 12:13:12 PM10/6/12
to ne...@googlegroups.com
Does it also fail when you execute it with curl on the commandline or the http console?

Could you please check the server logs ind data/log for exceptions too?

Thanks a lot

Seems a bit like a problem between cypher parameters and batch rest params. Or something with the parameter generation in SDN. 
would it be possible to generate a unit test that exposes that behavior.

Michael


Sent from mobile device
--
 
 

Abdul Azeez Shaik

unread,
Oct 6, 2012, 1:30:31 PM10/6/12
to ne...@googlegroups.com
Hi Michael,

Thanks for the response.
Yes, below query worked pretty well on web console of Neo4j,
START category=node:productline("productline:DENIM") WITH collect(category) as categories START user=node:search("name:*") WHERE ALL( c in categories WHERE user-[:has_category]-c) RETURN user;

and SDN fails for the below one,

@Query( "START category=node:productline({0}) WITH collect(category) as categories " +

"START user=node:search({1}) " +

"WHERE ALL( c in categories WHERE user-[:has_category]->c) RETURN user")


PFA, the neo4j.0.0.log which i found in data directory. Kindly let me know if there are any other logs which i can send,
Coming to unit testing, am pretty new to java, so not sure on how to write, if you can provide me link/code for any other cypher query and i could replicate and give it to you immediately.

Another issue is, following query doesn't return any rows, Whereas they return rows when i give ONLY denim or ...
START category=node:productline("productline:MENS_BAGS OR DENIM") RETURN category;
Is there any other way of achieving this?

Thanks,
Abdul

--
 
 

neo4j.0.0.log

Michael Hunger

unread,
Oct 6, 2012, 1:41:14 PM10/6/12
to ne...@googlegroups.com
I meant the HTTP console where you can issue http requests directly.


Sent from mobile device
--
 
 
<neo4j.0.0.log>

Abdul Azeez Shaik

unread,
Oct 6, 2012, 2:12:46 PM10/6/12
to ne...@googlegroups.com
Hi Michael,

Here is the reply for curl command, i just tried one parameter,

curl -H "accept:application/json"   -H "content-type:application/json" -d'{"query":"START category=node:productline(\"productline:DENIM\") WITH collect(category) as categories START user=node:search({param1}) WHERE ALL( c in categories WHERE user-[:has_category]-c) RETURN user", "params": {"param1":"name:*"}}' http://localhost:7474/db/data/cypher
{
  "message" : "Expected a parameter named param1",
  "exception" : "BadInputException",
  "stacktrace" : [ "org.neo4j.server.rest.repr.RepresentationExceptionHandlingIterable.exceptionOnHasNext(RepresentationExceptionHandlingIterable.java:51)", "org.neo4j.helpers.collection.ExceptionHandlingIterable$1.hasNext(ExceptionHandlingIterable.java:61)", "org.neo4j.helpers.collection.IteratorWrapper.hasNext(IteratorWrapper.java:42)", "org.neo4j.server.rest.repr.ListRepresentation.serialize(ListRepresentation.java:58)", "org.neo4j.server.rest.repr.Serializer.serialize(Serializer.java:75)", "org.neo4j.server.rest.repr.MappingSerializer.putList(MappingSerializer.java:61)", "org.neo4j.server.rest.repr.CypherResultRepresentation.serialize(CypherResultRepresentation.java:50)", "org.neo4j.server.rest.repr.MappingRepresentation.serialize(MappingRepresentation.java:42)", "org.neo4j.server.rest.repr.OutputFormat.format(OutputFormat.java:170)", "org.neo4j.server.rest.repr.OutputFormat.formatRepresentation(OutputFormat.java:120)", "org.neo4j.server.rest.repr.OutputFormat.response(OutputFormat.java:107)", "org.neo4j.server.rest.repr.OutputFormat.ok(OutputFormat.java:55)", "org.neo4j.server.rest.web.CypherService.cypher(CypherService.java:80)", "java.lang.reflect.Method.invoke(Method.java:597)" ]

--
 
 

Michael Hunger

unread,
Oct 6, 2012, 2:40:29 PM10/6/12
to ne...@googlegroups.com
Can you try to use neo4j 1.8 ga

There was one issue regarding params resolved
Not sure if before or after 1.8.rc1

Michael

Sent from mobile device
--
 
 

Abdul Azeez Shaik

unread,
Oct 6, 2012, 10:56:17 PM10/6/12
to ne...@googlegroups.com
Hi Micheal,

I tried it on 1.8GA, it throws same error,
curl -H "accept:application/json"   -H "content-type:application/json" -d'{"query":"START category=node:productline(\"productline:DENIM\") WITH collect(category) as categories START user=node:search({param1}) RETURN user", "params": {"param1":"name:*"}}' http://localhost:7474/db/data/cypher
{
  "message" : "Expected a parameter named param1",
  "exception" : "BadInputException",
  "stacktrace" : [ "org.neo4j.server.rest.repr.RepresentationExceptionHandlingIterable.exceptionOnHasNext(RepresentationExceptionHandlingIterable.java:51)", "org.neo4j.helpers.collection.ExceptionHandlingIterable$1.hasNext(ExceptionHandlingIterable.java:61)", "org.neo4j.helpers.collection.IteratorWrapper.hasNext(IteratorWrapper.java:42)", "org.neo4j.server.rest.repr.ListRepresentation.serialize(ListRepresentation.java:58)", "org.neo4j.server.rest.repr.Serializer.serialize(Serializer.java:75)", "org.neo4j.server.rest.repr.MappingSerializer.putList(MappingSerializer.java:61)", "org.neo4j.server.rest.repr.CypherResultRepresentation.serialize(CypherResultRepresentation.java:50)", "org.neo4j.server.rest.repr.MappingRepresentation.serialize(MappingRepresentation.java:42)", "org.neo4j.server.rest.repr.OutputFormat.format(OutputFormat.java:170)", "org.neo4j.server.rest.repr.OutputFormat.formatRepresentation(OutputFormat.java:120)", "org.neo4j.server.rest.repr.OutputFormat.response(OutputFormat.java:107)", "org.neo4j.server.rest.repr.OutputFormat.ok(OutputFormat.java:55)", "org.neo4j.server.rest.web.CypherService.cypher(CypherService.java:80)", "java.lang.reflect.Method.invoke(Method.java:597)" ]

I copied graph.db folder from data folder of RC1 to data folder of GA to get the old data(Kindly let me know if am missing anything here).

Kindly let me know how to move forward on this issue. I would try debugging into Neo4j code today.

Thanks,
 Abdul

--
 
 

Abdul Azeez Shaik

unread,
Oct 8, 2012, 11:47:02 AM10/8/12
to ne...@googlegroups.com
Hi Micheal,

Can i raise an issue for this?

Thanks,
Abdul

Michael Hunger

unread,
Oct 8, 2012, 11:57:35 AM10/8/12
to ne...@googlegroups.com
Yes, please do, in github.com/neo4j/community/issues

Thanks a lot

Michael

--
 
 

Abdul Azeez Shaik

unread,
Oct 8, 2012, 1:10:07 PM10/8/12
to ne...@googlegroups.com
Please find below the link for the same,
--
 
 

Peter Neubauer

unread,
Oct 16, 2012, 5:28:50 AM10/16/12
to ne...@googlegroups.com
Thanks Abdul, and it is closed now :)

Cheers,

/peter neubauer

G: neubauer.peter
S: peter.neubauer
P: +46 704 106975
L: http://www.linkedin.com/in/neubauer
T: @peterneubauer

Neo4j 1.8 GA - http://www.dzone.com/links/neo4j_18_release_fluent_graph_literacy.html


On Mon, Oct 8, 2012 at 7:10 PM, Abdul Azeez Shaik
> --
>
>

Abdul Azeez Shaik

unread,
Oct 16, 2012, 6:25:02 AM10/16/12
to ne...@googlegroups.com
Thanks for the prompt response on the issue.
Would this available as part of next 1.8 snapshot? or do i need to get latest 1.9?

Regards,
 Abdul

--



Peter Neubauer

unread,
Oct 17, 2012, 8:17:41 AM10/17/12
to ne...@googlegroups.com
I think this is 1.9-SNAPSHOT.

Cheers,

/peter neubauer

G: neubauer.peter
S: peter.neubauer
P: +46 704 106975
L: http://www.linkedin.com/in/neubauer
T: @peterneubauer

Neo4j 1.8 GA - http://www.dzone.com/links/neo4j_18_release_fluent_graph_literacy.html


On Tue, Oct 16, 2012 at 12:25 PM, Abdul Azeez Shaik
> --
>
>
Reply all
Reply to author
Forward
0 new messages