ruby-on-railsneo4jtorqueboxneo4j.rb

java.lang.IllegalStateException: Database locked


I have a problem with my neo4j database. I have a ruby on rails app with neo4jrb gem running with torquebox. I would like to read and write in my database with a torquebox job. But i have this error : java.lang.IllegalStateException: Database locked

It's look like my app already use a running instance of my database and I don't know how to use this instance in my job. I would like to know if it's possible to get the running instance in my job ? Or if you have an other solution to do this :)

Thanks


Solution

  • You won't be able to do this for the exact reason you identified: Neo4j Embedded runs the database and the Rails app in one JVM, nothing else will be able to interact with it directly. When I ran into this problem, I worked around it by exposing new REST endpoints within my app that performed the actions required by the jobs, then I wrote jobs to hit these endpoints and start the process within the app.