ashwini
ashwini

Reputation: 531

Error creating Neo4j relationships in java

I have created nodes and relationships in java, their values are coming from DB and will be dynamically assigned.

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();
        ...
    }
    ...
}

However i am getting an error --

"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)"

Please guide.

Upvotes: 1

Views: 98

Answers (2)

tstorms
tstorms

Reputation: 5001

As Stefan already suggested, you're having version conflicts with your jars. I strongly advise you to use maven or gradle to manage your dependencies. Neo4j 2.0.1 has the following dependencies, in case you still want to add them manually to your project:

[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

Upvotes: 1

Stefan Armbruster
Stefan Armbruster

Reputation: 39925

This looks most likely like having mixed versions of Neo4j on your classpath. Make sure that all Neo4j jars are used with the same version, that there are no duplicate jars on the classpath and all the dependencies are in place.

If further help is required, attach the current classpath settings here.

Upvotes: 0

Related Questions