neo4j-rest-binding with cypher queries

251 views
Skip to first unread message

Ranjith

unread,
Nov 13, 2013, 1:26:20 AM11/13/13
to ne...@googlegroups.com
Hi,

I am trying to execute a Cypher Query using the neo4j-rest-graphdb-2.0.0-M06.jar . from http://m2.neo4j.org/content/repositories/releases/org/neo4j/neo4j-rest-graphdb/2.0.0-M06/neo4j-rest-graphdb-2.0.0-M06.jar . 

The java code I use is :

RestAPI graphdb1 = new RestAPIFacade(dbpath);
QueryEngine engine1 = new RestCypherQueryEngine(graphdb1);
String cypherQuery= "match (X)-[:rel1]-(Y) where X:LABEL_X and Y:LABEL_Y return X.id,X.name";
engine1.query(cypherQuery, Collections.EMPTY_MAP);

I get an exception :

Exception in thread "main" java.lang.RuntimeException: Error reading as JSON ''
at org.neo4j.rest.graphdb.util.JsonHelper.readJson(JsonHelper.java:57)
at org.neo4j.rest.graphdb.util.JsonHelper.jsonToSingleValue(JsonHelper.java:62)
at org.neo4j.rest.graphdb.RequestResult.toEntity(RequestResult.java:114)
at org.neo4j.rest.graphdb.RequestResult.toMap(RequestResult.java:120)
at org.neo4j.rest.graphdb.ExecutingRestRequest.toMap(ExecutingRestRequest.java:212)
at org.neo4j.rest.graphdb.ExecutingRestAPI.query(ExecutingRestAPI.java:544)
at org.neo4j.rest.graphdb.ExecutingRestAPI.query(ExecutingRestAPI.java:564)
at org.neo4j.rest.graphdb.RestAPIFacade.query(RestAPIFacade.java:234)
at org.neo4j.rest.graphdb.query.RestCypherQueryEngine.query(RestCypherQueryEngine.java:50)
at com.unmetric.graph.test.GraphConnectTest.testRestApi(GraphConnectTest.java:39)
at com.unmetric.graph.test.GraphConnectTest.main(GraphConnectTest.java:26)
Caused by: java.io.EOFException: No content to map to Object due to end of input
at org.codehaus.jackson.map.ObjectMapper._initForReading(ObjectMapper.java:2775)
at org.codehaus.jackson.map.ObjectMapper._readMapAndClose(ObjectMapper.java:2718)
at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1863)
at org.neo4j.rest.graphdb.util.JsonHelper.readJson(JsonHelper.java:55)
... 10 more

On similar threads I read using transactional endpoints will cause this error, but I do not use any transactional code shown above. 
Can you identify what am I missing here ! Thanks .. 

Wes Freeman

unread,
Nov 19, 2013, 12:40:02 AM11/19/13
to ne...@googlegroups.com
It's probably getting a bad response. Are you sure your dbpath is correct? For example: "http://localhost:7474/db/data/"

If it is correct, check your messages.log to see if any exceptions were thrown--often the exceptions show up as non-JSON responses and can't be parsed.

Wes

--
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 neo4j+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages