我正在使用Neo4j 2.2.2的Spatial插件,并设法按照指南http://neo4j-contrib.github.io/spatial/#spatial-layers创建空间索引。
:POST http://localhost:7475/db/data/ext/SpatialPlugin/graphdb/addSimplePointLayer
{
"layer" : "geom",
"lat" : "lat",
"lon" : "lon"
}
:POST http://localhost:7474/db/data/index/node/
{
"name" : "geom",
"config" : {
"provider" : "spatial",
"geometry_type" : "point",
"lat" : "lat",
"lon" : "lon"
}
}
我预先存在未连接的节点,其中包含多个标签' DB_2'和'地址'和属性' name',' lon'和' lat',当我尝试将这些节点添加到空间索引时,我得到一个错误,但是如果我创建一个没有任何标签的节点,那么只是' lon'和' lat'它似乎没有任何错误。
:POST http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/addNodeToLayer
{
"layer" : "geom",
"node" : "http://localhost:7474/db/data/node/{id}"
}
500 Internal Server Error
==> {
==> "message" : "Error adding nodes to layer geom",
==> "exception" : "RuntimeException",
==> "fullname" : "java.lang.RuntimeException",
==> "stackTrace" : [ "org.neo4j.gis.spatial.server.plugin.SpatialPlugin.addNodeToLayer(SpatialPlugin. java:108)","java.lang.reflect.Method.invoke(Method.java:483)", "org.neo4j.server.plugins.PluginMethod.invoke(PluginMethod.java:61)","org.neo4j.server.plugins.PluginManager.invoke(PluginManager.java:158)", "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(Method.java:483)","org.neo4j.server.rest.transactional.TransactionalRequestDispatcher.dispatch(TransactionalRequestDispatcher.java:139)","org.neo4j.server.rest.dbms.AuthorizationFilter.doFilter(AuthorizationFilter.java:120)","java.lang.Thread.run(Thread.java:745)" ],
==> "cause" : {
==> "exception" : "ClassCastException",
==> "fullname" : "java.lang.ClassCastException",
==> "stackTrace" : [ "org.neo4j.gis.spatial.encoders.SimplePointEncoder.decodeGeometry(SimplePointEncoder.java:63)", " "org.neo4j.gis.spatial.DefaultLayer.add(DefaultLayer.java:77)", "org.neo4j.gis.spatial.server.plugin.SpatialPlugin.addNodeToLayer(SpatialPlugin.java:102)", "java.lang.reflect.Method.invoke(Method.java:483)", "org.neo4j.server.plugins.PluginMethod.invoke(PluginMethod.java:61)", "org.neo4j.server.plugins.PluginManager.invoke(PluginManager.java:158)", "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(Method.java:483)", "org.neo4j.server.rest.transactional.TransactionalRequestDispatcher.dispatch(TransactionalRequestDispatcher.java:139)", "org.neo4j.server.rest.dbms.AuthorizationFilter.doFilter(AuthorizationFilter.java:120)", "java.lang.Thread.run(Thread.java:745)" ],
==> "message" : "java.lang.String cannot be cast to java.lang.Number",
==> "errors" : [ {
==> "code" : "Neo.DatabaseError.General.UnknownFailure",
==> "stackTrace" : "java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number\r\n\tat org.neo4j.gis.spatial.encoders.SimplePointEncoder.decodeGeometry(SimplePointEncoder.java:63)\r\n\tat org.neo4j.gis.spatial.DefaultLayer.add(DefaultLayer.java:77)\r\n\tat org.neo4j.gis.spatial.server.plugin.SpatialPlugin.addNodeToLayer(SpatialPlugin.java:102)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\r\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n\tat java.lang.reflect.Method.invoke(Method.java:483)\r\n\tat org.neo4j.server.plugins.PluginMethod.invoke(PluginMethod.java:61)\r\n\tat org.neo4j.server.plugins.PluginManager.invoke(PluginManager.java:158)\r\n\tat org.neo4j.server.rest.web.ExtensionService.invokeGraphDatabaseExtension(ExtensionService.java:312)\r\n\tat org.neo4j.server.rest.web.ExtensionService.invokeGraphDatabaseExtension(ExtensionService.java:134)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\r\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n\tat java.lang.reflect.Method.invoke(Method.java:483)\r\n\tat com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)\r\n\tat com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)\r\n\tat com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)\r\n\tat org.neo4j.server.rest.transactional.TransactionalRequestDispatcher.dispatch(TransactionalRequestDispatcher.java:139)\r\n\tat com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302)\r\n\tat com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)\r\n\tat com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)\r\n\tat com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)\r\n\tat com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)\r\n\tat com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1542)\r\n\tat com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1473)\r\n\tat com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1419)\r\n\tat com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1409)\r\n\tat com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:409)\r\n\tat com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:540)\r\n\tat com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:715)\r\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:790)\r\n\tat org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:800)\r\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)\r\n\tat org.neo4j.server.rest.dbms.AuthorizationFilter.doFilter(AuthorizationFilter.java:120)\r\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)\r\n\tat org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)\r\n\tat org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221)\r\n\tat org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1125)\r\n\tat org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)\r\n\tat org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)\r\n\tat org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1059)\r\n\tat org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)\r\n\tat org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52)\r\n\tat org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)\r\n\tat org.eclipse.jetty.server.Server.handle(Server.java:497)\r\n\tat org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)\r\n\tat org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:248)\r\n\tat org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)\r\n\tat org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:620)\r\n\tat org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:540)\r\n\tat java.lang.Thread.run(Thread.java:745)\r\n",
==> "message" : "java.lang.String cannot be cast to java.lang.Number"
==> } ]
==> },
==> "errors" : [ {
==> "code" : "Neo.DatabaseError.General.UnknownFailure",
==> "stackTrace" : "java.lang.RuntimeException: Error adding nodes to layer geom\r\n\tat org.neo4j.gis.spatial.server.plugin.SpatialPlugin.addNodeToLayer(SpatialPlugin.java:108)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\r\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n\tat java.lang.reflect.Method.invoke(Method.java:483)\r\n\tat org.neo4j.server.plugins.PluginMethod.invoke(PluginMethod.java:61)\r\n\tat org.neo4j.server.plugins.PluginManager.invoke(PluginManager.java:158)\r\n\tat org.neo4j.server.rest.web.ExtensionService.invokeGraphDatabaseExtension(ExtensionService.java:312)\r\n\tat org.neo4j.server.rest.web.ExtensionService.invokeGraphDatabaseExtension(ExtensionService.java:134)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\r\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n\tat java.lang.reflect.Method.invoke(Method.java:483)\r\n\tat com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)\r\n\tat com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)\r\n\tat com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)\r\n\tat org.neo4j.server.rest.transactional.TransactionalRequestDispatcher.dispatch(TransactionalRequestDispatcher.java:139)\r\n\tat com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302)\r\n\tat com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)\r\n\tat com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)\r\n\tat com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)\r\n\tat com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)\r\n\tat com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1542)\r\n\tat com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1473)\r\n\tat com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1419)\r\n\tat com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1409)\r\n\tat com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:409)\r\n\tat com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:540)\r\n\tat com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:715)\r\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:790)\r\n\tat org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:800)\r\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)\r\n\tat org.neo4j.server.rest.dbms.AuthorizationFilter.doFilter(AuthorizationFilter.java:120)\r\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)\r\n\tat org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)\r\n\tat org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221)\r\n\tat org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1125)\r\n\tat org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)\r\n\tat org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)\r\n\tat org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1059)\r\n\tat org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)\r\n\tat org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52)\r\n\tat org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)\r\n\tat org.eclipse.jetty.server.Server.handle(Server.java:497)\r\n\tat org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)\r\n\tat org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:248)\r\n\tat org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)\r\n\tat org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:620)\r\n\tat org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:540)\r\n\tat java.lang.Thread.run(Thread.java:745)\r\nCaused by: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number\r\n\tat org.neo4j.gis.spatial.encoders.SimplePointEncoder.decodeGeometry(SimplePointEncoder.java:63)\r\n\tat org.neo4j.gis.spatial.DefaultLayer.add(DefaultLayer.java:77)\r\n\tat org.neo4j.gis.spatial.server.plugin.SpatialPlugin.addNodeToLayer(SpatialPlugin.java:102)\r\n\t... 49 more\r\n",
==> "message" : "Error adding nodes to layer geom"
==> } ]
==> }
我不确定它是否与我的节点标签或属性有任何关系,因为我无法从指南或其他示例中找到任何迹象表明这可能是一个问题。
提前感谢您的帮助!