neo4jrb / neo4j-core

A simple unified API that can access both the server and embedded Neo4j database. Used by the neo4j gem
MIT License
99 stars 80 forks source link

NameError: missing class name (`org.neo4j.graphdb.factory.GraphDatabaseFactory') #337

Open l7x opened 4 years ago

l7x commented 4 years ago

I'm getting this error with basic embedded example:

NameError: missing class name (`org.neo4j.graphdb.factory.GraphDatabaseFactory')
from org/jruby/javasupport/JavaPackage.java:124:in `const_missing'

I followed the documentation, but I'm not sure if I need to install anything else manually or everything should be already bundled.

Code example:

require 'neo4j/core/cypher_session/adaptors/embedded'
neo4j_adaptor = Neo4j::Core::CypherSession::Adaptors::Embedded.new('/tmp/graph.db')
neo4j_session = Neo4j::Core::CypherSession.new(neo4j_adaptor)

Runtime information:

jruby 9.2.9.0 on linux Neo4j database version: embedded neo4j gem version: neo4j-9.6.1.gem neo4j-core gem version: neo4j-core-9.0.0

klobuczek commented 4 years ago

@l7x since you are running embedded you must be including neo4j jar files. There is the neo4j-community gem, but it is hopelessly outdated. If you must run in embedded mode you are on your own and must find a way to add the entire set of neo4j server jar files to your ruby project. Have a look at jar-dependencies and ruby-maven gems. Let me know if you succeed. Otherwise run in server mode as nearly everyone does nowadays.

l7x commented 4 years ago

Thank you for the quick response. Documentation (and wiki) on embedded mode is very confusing. Unfortunately, I can't run server mode due to some requirements.

I'll check ruby-maven and jar-dependencies. If I get this working, are there any additional problems I can expect with neo4jrb and embedded mode in the long run?