2012-09-08 70 views
2

我试图创建一个基于http://docs.neo4j.org/chunked/snapshot/server-plugins.html安装的Neo4j REST服务器插件

我提出了Amazon EC2实例与Neo4j 1.7.2 CE Ubuntu 12.04 64-bit (ami-f3c8679a)对Neo4j的REST服务器样本服务器插件,它的工作 - 我试图让MyEC2DNS:7474/db/data所以当得到适当的回应服务器是可以的。

在Eclipse

  • 创建新的Java项目
  • 创建libs文件夹,复制从下载1.7.2 Neo4j Community Edition所有文件 - neo4j-community-1.7.2/lib和与内容将他们添加到构建路径
  • 创建样品课程package com.neo4j.server.plugins.example

代码(来自https://github.com/neo4j/community/blob/master/server-examples/src/main/java/org/neo4j/examples/server/plugins/GetAll.java

@Description("An extension to the Neo4j Server for getting all nodes or relationships") 
public class GetAll extends ServerPlugin { 

    @Name("get_all_nodes") 
    @Description("Get all nodes from the Neo4j graph database") 
    @PluginTarget(GraphDatabaseService.class) 
    public Iterable<Node> getAllNodes(@Source GraphDatabaseService graphDb) { 
     return GlobalGraphOperations.at(graphDb).getAllNodes(); 
    } 

    @Description("Get all relationships from the Neo4j graph database") 
    @PluginTarget(GraphDatabaseService.class) 
    public Iterable<Relationship> getAllRelationships(@Source GraphDatabaseService graphDb) { 
     return GlobalGraphOperations.at(graphDb).getAllRelationships(); 
    } 
} 
    在Eclipse
  • 创建的文件org.neo4j.server.plugins.ServerPluginMETA-INF/services使用单线com.neo4j.server.plugins.example.GetAll
  • 位于Java项目文件夹,并执行jar -cvf get_all.jar * - 我〜13MB .jar文件
  • 它复制到我的Amazon EC2实例/opt/neo4j/neo4j-community-1.7.2/plugins
  • 重新启动Neo4j服务器与sudo -u neo4j ./bin/neo4j restart
  • 我得到的是

响应

Stopping Neo4j server [1718].... done 
./bin/neo4j: line 174: ulimit: open files: cannot modify limit: Operation not permitted 
Starting Neo4j Server...WARNING: not chaning user 
process [1891]... waiting for server to be ready...... OK 

不过,当我得到MyEC2DNS:7474/db/data扩展名是不可见的。

想法?我的猜测是,这个插件可能太大了(不需要包含所有这些.jar,但是另一种方式 - 将它们放在相对路径中,怎么做?)。

+0

为了验证,您是否尝试过将neo4j-server-examples.jar放入plugins文件夹并使其工作? –

回答

3

解决,所有的步骤都是一样的问题,除了

positioned in Java project folder and executed jar -cvf get_all.jar * - I got ~13Mb .jar file

这应该是

- in Eclipse go to File - Export - JAR - export everything except 'lib' folder

那么它的正常使用,当然插件本身〜仅限100 kB。