SteelBridgeLabs / neo4j-gremlin-bolt

Apache License 2.0
0 stars 1 forks source link

`traversal()` throws `ClassNotFoundException`: `Neo4JGraph` in Console #68

Closed kuzeko closed 6 years ago

kuzeko commented 6 years ago

I open a gremlin console and provide the following:

      :install com.steelbridgelabs.oss neo4j-gremlin-bolt 0.2.27
      import com.steelbridgelabs.oss.neo4j.structure.providers.*
      import com.steelbridgelabs.oss.neo4j.structure.Neo4JGraph
      import com.steelbridgelabs.oss.*
      import org.apache.tinkerpop.*
      import org.neo4j.driver.v1.*
      driver = GraphDatabase.driver("bolt://172.17.0.1", AuthTokens.none())
      vertexIdProvider = new Neo4JNativeElementIdProvider();
      edgeIdProvider = new Neo4JNativeElementIdProvider();
      graph = new Neo4JGraph(driver, vertexIdProvider, edgeIdProvider);
      graph.execute("MATCH (n) RETURN COUNT(n)")
==>Record<{COUNT(n): 72404601}>

All goes well, got connection and results! But when I run :

          graph.traversal()

I get the error

java.lang.IllegalStateException: com.steelbridgelabs.oss.neo4j.structure.Neo4JGraph
        at org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies$GlobalCache.getStrategies(TraversalStrategies.java:253)
        at org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource.<init>(GraphTraversalSource.java:94)
[...]
Caused by: java.lang.ClassNotFoundException: com.steelbridgelabs.oss.neo4j.structure.Neo4JGraph
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:264)
        at org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies$GlobalCache.getStrategies(TraversalStrategies.java:251)
        ... 48 more

Not sure where I'm doing it wrong...

rjbaucells commented 6 years ago

Sorry for the late response, I have not tried using the library within the gremlin console. It is weird that the class that cannot be found is the actual Neo4JGraph, and it has been loaded already in memory since you were able to issue the previous command.

kuzeko commented 6 years ago

I have a dockerfile for the setup if this helps.

kuzeko commented 6 years ago

Any news? How can I help exactly?

rjbaucells commented 6 years ago

Can you do some troubleshooting on your side? As I said, I have never use it within the gremlin console. This library has been running in production for more than one year in a java application using the Tinkerpop API.

kuzeko commented 6 years ago

Sure, what can I do? As I said, the steps to reproduce are above: download the gremlin console, install and import, then call graph.traversal()

rjbaucells commented 6 years ago

Just downloaded the gremlin console, make sure you are using version 3.3.0 since this is the version this library has a dependency on:

         \,,,/
         (o o)
-----oOOo-(3)-oOOo-----
plugin activated: tinkerpop.server
plugin activated: tinkerpop.utilities
plugin activated: tinkerpop.tinkergraph
gremlin> import org.neo4j.driver.v1.*
gremlin> import org.apache.tinkerpop.*
gremlin> import com.steelbridgelabs.oss.*
gremlin> import com.steelbridgelabs.oss.neo4j.structure.*
gremlin> import com.steelbridgelabs.oss.neo4j.structure.providers.*
gremlin> driver = GraphDatabase.driver("bolt://127.0.0.1", AuthTokens.basic("neo4j","XXXX"))
gremlin> vertexIdProvider = new Neo4JNativeElementIdProvider();
gremlin> edgeIdProvider = new Neo4JNativeElementIdProvider();
gremlin> graph = new Neo4JGraph(driver, vertexIdProvider, edgeIdProvider);
gremlin> graph.execute("MATCH (n) RETURN COUNT(n)")

==>Record<{COUNT(n): 1338802}>

gremlin> graph.traversal()

No errors, notice that I changed the order of the import packages and also imported everything within the com.steelbridgelabs.oss.neo4j.structure package.

kuzeko commented 6 years ago

I've followed your steps, but I've got the same error. There are only 2 things that are different. Plugin installation and AuthTokens (I do not use usr/pwd, but I use .none()) Assuming authetincation being invariant. How did you install the plugin? I do not see in your steps the command :install com.steelbridgelabs.oss neo4j-gremlin-bolt 0.2.27

Thanks

rjbaucells commented 6 years ago

Same command as the one you used, after installing the plugin I exit the console and open it again and performed the steps I put on my last post.

kuzeko commented 6 years ago

Amazing, that's it. After installation the console needs to be restarted. Wow! I wonder if this was written in the gremlin docs and I've missed it. Thanks for the patience. All solved!