在neo4j中使用嵌入式HA

时间:2014-03-13 11:13:17

标签: neo4j

它给我jar错误我在我的项目中包含neo4j-server但它应该需要

错误代码如下

java.lang.NoClassDefFoundError: org/neo4j/com/Server$Configuration
    at org.neo4j.kernel.ha.HighlyAvailableGraphDatabase.createIdGeneratorFactory(HighlyAvailableGraphDatabase.java:437)
    at org.neo4j.kernel.InternalAbstractGraphDatabase.create(InternalAbstractGraphDatabase.java:480)
    at org.neo4j.kernel.ha.HighlyAvailableGraphDatabase.create(HighlyAvailableGraphDatabase.java:168)
    at org.neo4j.kernel.InternalAbstractGraphDatabase.run(InternalAbstractGraphDatabase.java:304)
    at org.neo4j.kernel.ha.HighlyAvailableGraphDatabase.<init>(HighlyAvailableGraphDatabase.java:157)
    at org.neo4j.graphdb.factory.HighlyAvailableGraphDatabaseFactory$1.newDatabase(HighlyAvailableGraphDatabaseFactory.java:47)
    at org.neo4j.graphdb.factory.GraphDatabaseBuilder.newGraphDatabase(GraphDatabaseBuilder.java:197)
    at com.migrate.work.Migrate.sample(Migrate.java:18)
    at com.migrate.work.Migrate.main(Migrate.java:51)
Caused by: java.lang.ClassNotFoundException: org.neo4j.com.Server$Configuration
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 9 more

1 个答案:

答案 0 :(得分:0)

您应该在类路径中拥有neo4j-enterprise依赖项。最好使用像maven,ivy,gradle这样的构建系统来自动提取依赖项。

你应该有这样的东西

[INFO] +- org.neo4j:neo4j-enterprise:jar:2.0.0:compile
[INFO] |  +- org.neo4j:neo4j-advanced:jar:2.0.0:compile
[INFO] |  |  +- org.neo4j:neo4j-community:jar:2.0.0:compile
[INFO] |  |  |  +- org.neo4j:neo4j-graph-algo:jar:2.0.0:compile
[INFO] |  |  |  +- org.neo4j:neo4j-udc:jar:2.0.0:compile
[INFO] |  |  |  +- org.neo4j:neo4j-graph-matching:jar:2.0.0:compile
[INFO] |  |  |  +- org.neo4j:neo4j-cypher:jar:2.0.0:compile
[INFO] |  |  |  |  +- org.neo4j:neo4j-cypher-commons:jar:2.0.0:compile
[INFO] |  |  |  |  +- org.neo4j:neo4j-cypher-compiler-1.9:jar:2.0.0:compile
[INFO] |  |  |  |  +- org.neo4j:neo4j-cypher-compiler-2.0:jar:2.0.0:compile
[INFO] |  |  |  |  |  \- org.parboiled:parboiled-scala_2.10:jar:1.1.6:compile
[INFO] |  |  |  |  |     \- org.parboiled:parboiled-core:jar:1.1.6:compile
[INFO] |  |  |  |  \- org.scala-lang:scala-library:jar:2.10.3:compile
[INFO] |  |  |  \- org.neo4j:neo4j-jmx:jar:2.0.0:compile
[INFO] |  |  \- org.neo4j:neo4j-management:jar:2.0.0:compile
[INFO] |  +- org.neo4j:neo4j-com:jar:2.0.0:compile
[INFO] |  |  +- io.netty:netty:jar:3.6.3.Final:compile
[INFO] |  |  \- ch.qos.logback:logback-classic:jar:1.0.9:compile
[INFO] |  |     +- ch.qos.logback:logback-core:jar:1.0.9:compile
[INFO] |  |     \- org.slf4j:slf4j-api:jar:1.7.2:compile
[INFO] |  +- org.neo4j:neo4j-backup:jar:2.0.0:compile
[INFO] |  |  +- org.neo4j:neo4j-cluster:jar:2.0.0:compile
[INFO] |  |  \- org.neo4j:neo4j-consistency-check:jar:2.0.0:compile
[INFO] |  \- org.neo4j:neo4j-ha:jar:2.0.0:compile