我在java中创建了节点和关系,它们的值来自数据库并将被动态分配。
GraphDatabaseService graphDb= new GraphDatabaseFactory().newEmbeddedDatabase("D://MyGraph);
//Data access logic Code here
.............
while(rs.next())
{
String node1= rs.getString("App_Name");
String rel = rs.getString("Interface_Name");
String node2= rs.getString("Corresponding_App");
Transaction tx=graphDb.beginTx();
try{
RelationshipType rel1 =DynamicRelationshipType.withName(rel);
Node nodeName1 = graphDb.createNode();
Node nodeName2 = graphDb.createNode();
nodeName1.addLabel(DynamicLabel.label((node1)));
nodeName1.setProperty("name", (node1));
nodeName2.addLabel(DynamicLabel.label((node2)));
nodeName2.setProperty("name", (node2));
nodeName1.createRelationshipTo(nodeName2, rel1);
tx.success();
...
}
...
}
但是我收到了错误 -
"java.lang.AbstractMethodError: org.neo4j.graphdb.index.IndexProvider.load(Lorg/neo4j/graphdb/DependencyResolver;)Lorg/neo4j/graphdb/index/IndexImplementation; at org.neo4j.graphdb.index.IndexProviderKernelExtensionFactory$IndexProviderKernelExtension.start(IndexProviderKernelExtensionFactory.java:72)
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:498)"
请指导。
答案 0 :(得分:1)
正如Stefan已经建议的那样,你的版本与你的罐子有冲突。我强烈建议您使用maven或gradle来管理您的依赖项。 Neo4j 2.0.1具有以下依赖关系,以防您仍想手动将它们添加到项目中:
[INFO] \- org.neo4j:neo4j:jar:2.0.1:compile
[INFO] +- org.neo4j:neo4j-kernel:jar:2.0.1:compile
[INFO] | \- org.apache.geronimo.specs:geronimo-jta_1.1_spec:jar:1.1.1:compile
[INFO] +- org.neo4j:neo4j-lucene-index:jar:2.0.1:compile
[INFO] | \- org.apache.lucene:lucene-core:jar:3.6.2:compile
[INFO] +- org.neo4j:neo4j-graph-algo:jar:2.0.1:compile
[INFO] +- org.neo4j:neo4j-udc:jar:2.0.1:compile
[INFO] +- org.neo4j:neo4j-graph-matching:jar:2.0.1:compile
[INFO] +- org.neo4j:neo4j-cypher:jar:2.0.1:compile
[INFO] | +- org.neo4j:neo4j-cypher-commons:jar:2.0.1:compile
[INFO] | +- org.neo4j:neo4j-cypher-compiler-1.9:jar:2.0.1:compile
[INFO] | +- org.neo4j:neo4j-cypher-compiler-2.0:jar:2.0.1:compile
[INFO] | | \- org.parboiled:parboiled-scala_2.10:jar:1.1.6:compile
[INFO] | | \- org.parboiled:parboiled-core:jar:1.1.6:compile
[INFO] | +- com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:jar:1.3.1:compile
[INFO] | \- org.scala-lang:scala-library:jar:2.10.3:compile
[INFO] \- org.neo4j:neo4j-jmx:jar:2.0.1:compile
答案 1 :(得分:0)
这看起来很像是在你的类路径上混合版本的Neo4j。确保所有Neo4j jar都使用相同的版本,类路径上没有重复的jar,并且所有依赖项都已到位。
如果需要进一步的帮助,请在此处附加当前的类路径设置。