简体   繁体   English

在jar中包含Neo4j服务器

[英]Include Neo4j server in jar

I am creating a Clojure application that uses Neo4J via the REST API, and I would like to include Neo4j as a dependency. 我正在创建一个通过REST API使用Neo4J的Clojure应用程序,我想将Neo4j作为依赖项包括在内。

I read that it is possible to embed Neo4j http://docs.neo4j.org/chunked/stable/tutorials-java-embedded.html 我读到可以嵌入Neo4j http://docs.neo4j.org/chunked/stable/tutorials-java-embedded.html

But is it also possible to use the REST API that way? 但是也可以通过这种方式使用REST API吗?

This is what my project.clj looks like: 这是我的project.clj样子:

(defproject example "0.1.0-SNAPSHOT"
  :dependencies [[org.clojure/clojure "1.5.1"]
                 [clojurewerkz/neocons "2.0.0"]
                 [org.neo4j.app/neo4j-server "2.1.0-M01"]]
  :aliases {"neo4j" ["run" "-m" "org.neo4j.server.Bootstrapper"]}
  :jvm-opts ["-Dorg.neo4j.server.database.location=data/graph.db"]
)

But it fails with WARNING: The key [org.neo4j.server.database.location] is missing from the Neo Server configuration. 但是它失败并WARNING: The key [org.neo4j.server.database.location] is missing from the Neo Server configuration. and then throws a bunch of exceptions, indicating it did not find a database location. 然后抛出一堆异常,表明它找不到数据库位置。

I tried adding the above JVM opts, and copied the neo4j-server.properties to the resources folder without any luck. 我尝试添加上述JVM选项,并将neo4j-server.properties复制到resources文件夹中,但没有任何运气。

Neo4j will look for the configuration in /etc/neo/conf/neo4j-server.properties . Neo4j将在/etc/neo/conf/neo4j-server.properties寻找配置。 Try putting the 'org.neo4j.server.database.location=data/graph.db' in there. 尝试将“ org.neo4j.server.database.location = data / graph.db”放入其中。

Or you create your own subclass of CommunityBoostrapper that also accepts the argument from the command line, should be easy enough. 或者您创建自己的CommunityBoostrapper子类,该子类也从命令行接受参数,应该很容易。

Check my little side project for some hints: 检查我的小项目以获取一些提示:

https://github.com/jexp/neo4j-in-memory-server https://github.com/jexp/neo4j-in-memory-server

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM