我试图创建一个基于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
@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.ServerPlugin
内META-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,但是另一种方式 - 将它们放在相对路径中,怎么做?)。
为了验证,您是否尝试过将neo4j-server-examples.jar放入plugins文件夹并使其工作? –