neo4j-spatial - 无法通过neo4j REST API创建简单的点图层

时间:2014-05-04 17:52:15

标签: java neo4j jersey neo4j-spatial

我跟随the neo4j spatial documentation和github上的test file一起设置neo4j空间点层结构。 我在Windows 7上使用neo4j 2.0.2,克隆了空间2.0.2。存储库并将空间插件安装到我的\ plugins文件夹中(该插件也列在neo4j浏览器的插件部分下)。

我试图通过执行以下代码(使用Jersey)来设置点索引:

final String txUri = "http://localhost:7575/db/data/ext/SpatialPlugin/graphdb/addSimplePointLayer"; 
        WebResource resource = Client.create().resource( txUri );

        String payload = "{\"layer\":\"geom\", \"lat\":\"lat\", \"lon\":\"lon\"}";
            ClientResponse response = resource
                    .entity( payload )
                    .accept( MediaType.APPLICATION_JSON+"; charset=UTF-8")
                    .type( MediaType.APPLICATION_JSON )
                    .post( ClientResponse.class );

        return response.getEntity( String.class );

正如文档中所要求的,我包括" accept = appliaction / json"," Content-type = application / json"和POST头中的UTF-8编码。我从github上的测试文件中复制了POST请求的主体。但是我收到状态500错误:

  
    

com.sun.jersey.api.client.ClientHandlerException:java.net.ConnectException:连接被拒绝:连接       com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:155)       com.sun.jersey.api.client.Client.handle(Client.java:652)       com.sun.jersey.api.client.WebResource.handle(WebResource.java:682)       com.sun.jersey.api.client.WebResource.access $ 200(WebResource.java:74)       com.sun.jersey.api.client.WebResource $ Builder.post(WebResource.java:560)       com.youtube.rest.status.V1_status.createSpatialIndex(V1_status.java:67)       com.youtube.rest.status.V1_status.returnTitle(V1_status.java:24)       sun.reflect.NativeMethodAccessorImpl.invoke0(原生方法)       sun.reflect.NativeMethodAccessorImpl.invoke(未知来源)       sun.reflect.DelegatingMethodAccessorImpl.invoke(未知来源)       java.lang.reflect.Method.invoke(未知来源)       com.sun.jersey.spi.container.JavaMethodInvokerFactory $ 1.invoke(JavaMethodInvokerFactory.java:60)       com.sun.jersey.server.impl.model.method.dispatch.Abs​​tractResourceMethodDispatchProvider $ TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:185)       com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)       com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302)       com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)       com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)       com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)       com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1542)       com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1473)       com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1419)       com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1409)       com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:409)       com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:540)       com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:715)       javax.servlet.http.HttpServlet.service(HttpServlet.java:727)       org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)     根本原因

  
     

java.net.ConnectException:拒绝连接:连接     java.net.DualStackPlainSocketImpl.connect0(本机方法)     java.net.DualStackPlainSocketImpl.socketConnect(未知来源)     java.net.AbstractPlainSocketImpl.doConnect(未知来源)     java.net.AbstractPlainSocketImpl.connectToAddress(未知来源)     java.net.AbstractPlainSocketImpl.connect(未知来源)     java.net.PlainSocketImpl.connect(未知来源)     java.net.SocksSocketImpl.connect(未知来源)     java.net.Socket.connect(未知来源)     java.net.Socket.connect(未知来源)     sun.net.NetworkClient.doConnect(未知来源)     sun.net.www.http.HttpClient.openServer(未知来源)     sun.net.www.http.HttpClient.openServer(未知来源)     sun.net.www.http.HttpClient。(未知来源)     sun.net.www.http.HttpClient.New(未知来源)     sun.net.www.http.HttpClient.New(未知来源)     sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(未知   资源)     sun.net.www.protocol.http.HttpURLConnection.plainConnect(未知   来源)sun.net.www.protocol.http.HttpURLConnection.connect(未知   资源)     sun.net.www.protocol.http.HttpURLConnection.getOutputStream(未知   资源)     com.sun.jersey.client.urlconnection.URLConnectionClientHandler $ 1 $ 1.getOutputStream(URLConnectionClientHandler.java:238)     com.sun.jersey.api.client.CommittingOutputStream.commitStream(CommittingOutputStream.java:117)     com.sun.jersey.api.client.CommittingOutputStream.write(CommittingOutputStream.java:89)     sun.nio.cs.StreamEncoder.writeBytes(未知来源)     sun.nio.cs.StreamEncoder.implFlushBuffer(未知来源)     sun.nio.cs.StreamEncoder.implFlush(未知来源)     sun.nio.cs.StreamEncoder.flush(未知来源)     java.io.OutputStreamWriter.flush(未知来源)     java.io.BufferedWriter.flush(未知来源)     com.sun.jersey.core.util.ReaderWriter.writeToAsString(ReaderWriter.java:191)     com.sun.jersey.core.provider.AbstractMessageReaderWriterProvider.writeToAsString(AbstractMessageReaderWriterProvider.java:128)     com.sun.jersey.core.impl.provider.entity.StringProvider.writeTo(StringProvider.java:88)     com.sun.jersey.core.impl.provider.entity.StringProvider.writeTo(StringProvider.java:58)     com.sun.jersey.api.client.RequestWriter.writeRequestEntity(RequestWriter.java:300)     com.sun.jersey.client.urlconnection.URLConnectionClientHandler._invoke(URLConnectionClientHandler.java:217)     com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:153)     com.sun.jersey.api.client.Client.handle(Client.java:652)     com.sun.jersey.api.client.WebResource.handle(WebResource.java:682)     com.sun.jersey.api.client.WebResource.access $ 200(WebResource.java:74)     com.sun.jersey.api.client.WebResource $ Builder.post(WebResource.java:560)     com.youtube.rest.status.V1_status.createSpatialIndex(V1_status.java:67)     com.youtube.rest.status.V1_status.returnTitle(V1_status.java:24)     sun.reflect.NativeMethodAccessorImpl.invoke0(原生方法)     sun.reflect.NativeMethodAccessorImpl.invoke(未知来源)     sun.reflect.DelegatingMethodAccessorImpl.invoke(未知来源)     java.lang.reflect.Method.invoke(未知来源)     com.sun.jersey.spi.container.JavaMethodInvokerFactory $ 1.invoke(JavaMethodInvokerFactory.java:60)     com.sun.jersey.server.impl.model.method.dispatch.Abs​​tractResourceMethodDispatchProvider $ TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:185)     com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)     com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302)     com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)     com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)     com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)     com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1542)     com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1473)     com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1419)     com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1409)     com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:409)     com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:540)     com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:715)     javax.servlet.http.HttpServlet.service(HttpServlet.java:727)     org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

我认为这可能是我的tomcat服务器的问题。但是,Web服务的其他URL正在按预期工作。非常感谢任何帮助。

0 个答案:

没有答案