2

http://docs.neo4j.org/chunked/snapshot/server-plugins.htmlに基づいてNeo4jRESTサーバー用のサンプルサーバープラグインを作成しようとしています

私はAmazonEC2インスタンスをインストールしましたがNeo4j 1.7.2 CE Ubuntu 12.04 64-bit (ami-f3c8679a)、動作しています-取得しようとすると適切な応答が返されるMyEC2DNS:7474/db/dataので、サーバーは問題ありません。

日食で

  • 新しいJavaプロジェクトを作成しました
  • フォルダを作成し、ダウンロードしたファイルからすべてのlibsファイルをコピーし、ビルドパスに追加しました1.7.2 Neo4j Community Editionneo4j-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では、1行でファイルorg.neo4j.server.plugins.ServerPluginを作成しましたMETA-INF/servicescom.neo4j.server.plugins.example.GetAll
  • Javaプロジェクトフォルダに配置されて実行されjar -cvf get_all.jar *ました-〜13Mbの.jarファイルを取得しました
  • それを私のAmazonEC2インスタンスにコピーしました/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

それでも、GETしたときに拡張子が表示されませんMyEC2DNS:7474/db/data

アイデア?私の推測では、このプラグインは単純に大きすぎると思います(これらの.jarをすべて含める必要はありませんが、他の方法は何ですか?相対パスに配置するにはどうすればよいですか?)。

4

1 に答える 1

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

その後、それは完全に機能し、もちろんプラグイン自体は約100kBのみです。

于 2012-09-10T16:25:14.653 に答える