Hi Vipul,

I saw the same issue when trying to expose an embedded Neo4j database
(plus some other things) via a Spring webapp.

*"Caused by: java.lang.IllegalStateException: Unable to lock store
[\neo4j\db\project\graph-project\neostore], this is usually a result of
some other Neo4j kernel** running using the same store." *

The problem was that I was trying to instantiate the
GraphDatabaseService from two components with a new().

I ended up building a factory that instantiates a singleton and returns
a reference to the same GraphDatabaseService using a getInstance()
method to all the components that need a handle to it.

In my spring config I declare the bean containing the
GraphDatabaseService (nodeService) like so:

  <bean id="nodeService" class="...NodeServiceFactory"
    factory-method="getInstance" destroy-method="destroy"/>

where the NodeServiceFactory exposes 2 static methods getInstance() that
returns the singleton reference and destroy which closes the reference
on application shutdown.

In the app, where I was doing a nodeService = new NodeService(), I
replaced with nodeService = NodeService.getInstance().

-sujit


_______________________________________________
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to