carnival-data / carnival

JVM property graph data unification framework
https://carnival-data.github.io/carnival/
GNU General Public License v3.0
7 stars 2 forks source link

Expose the Bolt port of the embedded graph #65

Open augustearth opened 2 years ago

augustearth commented 2 years ago

Export the Bolt port by default of the embedded graph so that things like Neo4j Desktop can interact with it.

augustearth commented 2 years ago

Ugh. It would seem that we can't due (again) to a limitation of neo4j-tinkerpop-api-impl. I based my approach on Accessing Neo4j embedded via the Bolt protocol. In order to get the code to compile, the commented dependencies below were required.

        implementation "org.apache.tinkerpop:neo4j-gremlin:${gremlinVersion}"
        implementation "org.neo4j:neo4j-tinkerpop-api-impl:${neo4jTinkerpopVersion}"
        implementation "org.neo4j.driver:neo4j-java-driver:${neo4JavaDriverVersion}"
        //implementation "org.neo4j:parent:${neo4JavaDriverVersion}"
        //implementation "org.neo4j:neo4j-community:${neo4JavaDriverVersion}"
        //implementation "org.neo4j:neo4j-bolt:${neo4JavaDriverVersion}"

However, adding the neo4j-bolt dependency causes the following error in our core code:

CoreGraphNeo4jSpec > initializationError FAILED
    java.lang.NoClassDefFoundError: org/neo4j/graphdb/factory/GraphDatabaseFactory
        at java.base/java.lang.Class.forName(Class.java:315)
        at org.neo4j.tinkerpop.api.Neo4jFactory$Builder.open(Neo4jFactory.java:31)
        at org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraph.<init>(Neo4jGraph.java:135)
        at org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraph.open(Neo4jGraph.java:149)
        at carnival.core.graph.CoreGraphNeo4j.openGremlinGraph(CoreGraphNeo4j.groovy:127)
        at carnival.core.graph.CoreGraphNeo4j.create(CoreGraphNeo4j.groovy:54)
        at carnival.core.graph.CoreGraphNeo4jSpec.setupSpec(CoreGraphNeo4jSpec.groovy:61)

        Caused by:
        java.lang.ClassNotFoundException: org.neo4j.graphdb.factory.GraphDatabaseFactory
            at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
            at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
            at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
            ... 7 more

Our current dependency versions are:

groovyVersion=3.0.7
gremlinVersion=3.4.10
neo4jTinkerpopVersion=0.9-3.4.0
neo4JavaDriverVersion=4.1.1
javaVersion=11

Version 0.9-3.4.0 of neo4j-tinkerpop-api-impl was published in January of 2019. Version 4.1.1 of neo4j-java-driver and neo4j-bolt were published in 2020. neo4j-java-driver seems to be ok, but simply adding the dependency neo4j-bolt causes our code to fail even if there is no reference in our code to anything neo4j-bolt. Just adding the dependency messes things up.

th5 commented 2 years ago

I was able to get it to compile by setting neo4JavaDriverVersion=1.7.5

2.0.0-alpha3 also works. 4.0.0 does not. There doesn't appear to be a 3.x release.

https://mvnrepository.com/artifact/org.neo4j.driver/neo4j-java-driver