无法使用Neo4j Rest API进行查询 - 读取为JSON时出错“

时间:2014-01-13 17:53:41

标签: java rest neo4j

不确定我做错了什么,但是使用neo4j Rest API设置甚至基本的密码查询都不起作用。我得到一个java.lang.RuntimeException:读错为JSON''

我的设置

<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 '' "

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 '' "

1 个答案:

答案 0 :(得分:0)

我刚刚发布了2.0.0的java-rest-binding,所以请试一试。

M06不应该与Neo4j 2.0.0 final一起使用。