我正在尝试使用 neo4j 2.0 M06 在新安装的文件夹上运行“SPARQLPlugin”,数据库中没有数据,但我无法找到有关如何调用 REST 端点的示例。有没有一个例子展示了如何使用 rest 端点来玩 SPARQL?
我正在尝试使用 chrome Advanced rest 客户端,如下所示
我收到如下错误响应:
{
"message" : "java.lang.String cannot be cast to java.util.Map",
"exception" : "BadInputException",
"fullname" : "org.neo4j.server.rest.repr.BadInputException",
"stacktrace" : [ "org.neo4j.server.rest.repr.formats.JsonFormat.readMap(JsonFormat.java:92)", "org.neo4j.server.rest.repr.RepresentationFormat.readParameterList(RepresentationFormat.java:97)", "org.neo4j.server.rest.web.ExtensionService.invokeGraphDatabaseExtension(ExtensionService.java:134)", "java.lang.reflect.Method.invoke(Unknown Source)", "org.neo4j.server.rest.transactional.TransactionalRequestDispatcher.dispatch(TransactionalRequestDispatcher.java:132)", "org.neo4j.server.rest.security.SecurityFilter.doFilter(SecurityFilter.java:112)", "java.lang.Thread.run(Unknown Source)" ],
"cause" : {
"message" : "java.lang.String cannot be cast to java.util.Map",
"exception" : "ClassCastException",
"stacktrace" : [ "org.neo4j.server.rest.domain.JsonHelper.jsonToMap(JsonHelper.java:53)", "org.neo4j.server.rest.repr.formats.JsonFormat.readMap(JsonFormat.java:88)", "org.neo4j.server.rest.repr.RepresentationFormat.readParameterList(RepresentationFormat.java:97)", "org.neo4j.server.rest.web.ExtensionService.invokeGraphDatabaseExtension(ExtensionService.java:134)", "java.lang.reflect.Method.invoke(Unknown Source)", "org.neo4j.server.rest.transactional.TransactionalRequestDispatcher.dispatch(TransactionalRequestDispatcher.java:132)", "org.neo4j.server.rest.security.SecurityFilter.doFilter(SecurityFilter.java:112)", "java.lang.Thread.run(Unknown Source)" ],
"fullname" : "java.lang.ClassCastException"
}
}
我检查了该插件是否已加载到 neo4j 中,并且当我做一些愚蠢的事情时它也会抛出错误,所以我认为它可以正常工作。所以真的很期待看到如何使用它。
编辑:
正如下面所建议的,当我在我的有效负载周围包含 { } 时,堆栈跟踪是我得到500状态的地方
{
"message" : "com/tinkerpop/blueprints/impls/neo4j/Neo4jGraph",
"exception" : "NoClassDefFoundError",
"fullname" : "java.lang.NoClassDefFoundError",
"stacktrace" : [ "org.neo4j.server.plugin.sparql.SPARQLPlugin.initSail(SPARQLPlugin.java:90)", "org.neo4j.server.plugin.sparql.SPARQLPlugin.executeInsert(SPARQLPlugin.java:113)", "java.lang.reflect.Method.invoke(Unknown Source)", "org.neo4j.server.plugins.PluginMethod.invoke(PluginMethod.java:61)", "org.neo4j.server.plugins.PluginManager.invoke(PluginManager.java:168)", "org.neo4j.server.rest.web.ExtensionService.invokeGraphDatabaseExtension(ExtensionService.java:312)", "org.neo4j.server.rest.web.ExtensionService.invokeGraphDatabaseExtension(ExtensionService.java:134)", "java.lang.reflect.Method.invoke(Unknown Source)", "org.neo4j.server.rest.transactional.TransactionalRequestDispatcher.dispatch(TransactionalRequestDispatcher.java:132)", "org.neo4j.server.rest.security.SecurityFilter.doFilter(SecurityFilter.java:112)", "java.lang.Thread.run(Unknown Source)" ],
"cause" : {
"message" : "com.tinkerpop.blueprints.impls.neo4j.Neo4jGraph",
"exception" : "ClassNotFoundException",
"stacktrace" : [ "java.net.URLClassLoader$1.run(Unknown Source)", "java.net.URLClassLoader$1.run(Unknown Source)", "java.security.AccessController.doPrivileged(Native Method)", "java.net.URLClassLoader.findClass(Unknown Source)", "java.lang.ClassLoader.loadClass(Unknown Source)", "sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)", "java.lang.ClassLoader.loadClass(Unknown Source)", "org.neo4j.server.plugin.sparql.SPARQLPlugin.initSail(SPARQLPlugin.java:90)", "org.neo4j.server.plugin.sparql.SPARQLPlugin.executeInsert(SPARQLPlugin.java:113)", "java.lang.reflect.Method.invoke(Unknown Source)", "org.neo4j.server.plugins.PluginMethod.invoke(PluginMethod.java:61)", "org.neo4j.server.plugins.PluginManager.invoke(PluginManager.java:168)", "org.neo4j.server.rest.web.ExtensionService.invokeGraphDatabaseExtension(ExtensionService.java:312)", "org.neo4j.server.rest.web.ExtensionService.invokeGraphDatabaseExtension(ExtensionService.java:134)", "java.lang.reflect.Method.invoke(Unknown Source)", "org.neo4j.server.rest.transactional.TransactionalRequestDispatcher.dispatch(TransactionalRequestDispatcher.java:132)", "org.neo4j.server.rest.security.SecurityFilter.doFilter(SecurityFilter.java:112)", "java.lang.Thread.run(Unknown Source)" ],
"fullname" : "java.lang.ClassNotFoundException"
}
}
我最初没有包括这个,假设这是我如何将数据发布到端点的错误。
编辑 3
我尝试再次构建插件(使用“mvn package -DskipTests”,因为测试失败)这次将其指向插件 pom.xml 中的 2.4.0 蓝图并下载了缺少 blueprints-neo4j-graph-2.4 的正确版本.0.jar 用于蓝图。之后我看到一个新错误,但这次看起来越来越近了,可能又是一些版本不匹配。知道这是什么吗?
{
"message" : "org.neo4j.kernel.impl.core.NodeManager.getGraphProperties()Lorg/neo4j/kernel/impl/core/GraphProperties;",
"exception" : "NoSuchMethodError",
"fullname" : "java.lang.NoSuchMethodError",
"stacktrace" : [ "com.tinkerpop.blueprints.impls.neo4j.Neo4jGraph.getInternalIndexKeys(Neo4jGraph.java:235)", "com.tinkerpop.blueprints.impls.neo4j.Neo4jGraph.loadKeyIndices(Neo4jGraph.java:175)", "com.tinkerpop.blueprints.impls.neo4j.Neo4jGraph.<init>(Neo4jGraph.java:140)", "com.tinkerpop.blueprints.impls.neo4j.Neo4jGraph.<init>(Neo4jGraph.java:144)", "org.neo4j.server.plugin.sparql.SPARQLPlugin.initSail(SPARQLPlugin.java:90)", "org.neo4j.server.plugin.sparql.SPARQLPlugin.executeInsert(SPARQLPlugin.java:113)", "java.lang.reflect.Method.invoke(Unknown Source)", "org.neo4j.server.plugins.PluginMethod.invoke(PluginMethod.java:61)", "org.neo4j.server.plugins.PluginManager.invoke(PluginManager.java:168)", "org.neo4j.server.rest.web.ExtensionService.invokeGraphDatabaseExtension(ExtensionService.java:312)", "org.neo4j.server.rest.web.ExtensionService.invokeGraphDatabaseExtension(ExtensionService.java:134)", "java.lang.reflect.Method.invoke(Unknown Source)", "org.neo4j.server.rest.transactional.TransactionalRequestDispatcher.dispatch(TransactionalRequestDispatcher.java:132)", "org.neo4j.server.rest.security.SecurityFilter.doFilter(SecurityFilter.java:112)", "java.lang.Thread.run(Unknown Source)" ]
}
查询也返回类似的错误:
{
"message" : "org.neo4j.kernel.impl.core.NodeManager.getGraphProperties()Lorg/neo4j/kernel/impl/core/GraphProperties;",
"exception" : "NoSuchMethodError",
"fullname" : "java.lang.NoSuchMethodError",
"stacktrace" : [ "com.tinkerpop.blueprints.impls.neo4j.Neo4jGraph.getInternalIndexKeys(Neo4jGraph.java:235)", "com.tinkerpop.blueprints.impls.neo4j.Neo4jGraph.loadKeyIndices(Neo4jGraph.java:175)", "com.tinkerpop.blueprints.impls.neo4j.Neo4jGraph.<init>(Neo4jGraph.java:140)", "com.tinkerpop.blueprints.impls.neo4j.Neo4jGraph.<init>(Neo4jGraph.java:144)", "org.neo4j.server.plugin.sparql.SPARQLPlugin.initSail(SPARQLPlugin.java:90)", "org.neo4j.server.plugin.sparql.SPARQLPlugin.executeSPARQL(SPARQLPlugin.java:61)", "java.lang.reflect.Method.invoke(Unknown Source)", "org.neo4j.server.plugins.PluginMethod.invoke(PluginMethod.java:61)", "org.neo4j.server.plugins.PluginManager.invoke(PluginManager.java:168)", "org.neo4j.server.rest.web.ExtensionService.invokeGraphDatabaseExtension(ExtensionService.java:312)", "org.neo4j.server.rest.web.ExtensionService.invokeGraphDatabaseExtension(ExtensionService.java:134)", "java.lang.reflect.Method.invoke(Unknown Source)", "org.neo4j.server.rest.transactional.TransactionalRequestDispatcher.dispatch(TransactionalRequestDispatcher.java:132)", "org.neo4j.server.rest.security.SecurityFilter.doFilter(SecurityFilter.java:112)", "java.lang.Thread.run(Unknown Source)" ]
}
谢谢,基兰