简体   繁体   中英

Unable to query using Neo4j Rest API - Error reading as JSON ''

Not sure what I am doing wrong, but with my set up even a basic cypher query using the neo4j Rest API is not working. I get a java.lang.RuntimeException: Error reading as JSON ''

My set up

<dependency> 
    <groupId>org.neo4j</groupId> 
    <artifactId>neo4j-rest-graphdb</artifactId> 
    <version>2.0.0-M06</version>
</dependency>
<dependency>
    <groupId>org.neo4j</groupId>
    <artifactId>neo4j</artifactId>
    <version>2.0.0</version>
</dependency>
<dependency>
    <groupId>org.neo4j.app</groupId>
    <artifactId>neo4j-server</artifactId>
    <version>2.0.0</version>
</dependency>

 private GraphDatabaseService graphDb; private RestCypherQueryEngine queryEngine; System.setProperty("org.neo4j.rest.batch_transaction", "true"); graphDb = new RestGraphDatabase( "http://localhost:7474/db/data/" ); queryEngine = new RestCypherQueryEngine(((RestGraphDatabase)graphDb).getRestAPI()); StringBuilder query = new StringBuilder(); query.append("match (u { id:'").append(id).append("' }) return u"); QueryResult<Map<String,Object>> result = engine.query(query.toString(), null); //the above statement throws the runtime exception with message "Error reading as JSON '' " 

I just released 2.0.0 of java-rest-binding, so please give that a try.

M06 shouldn't really work with Neo4j 2.0.0 final.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM