Getting following exception
java.lang.RuntimeException: Error starting org.neo4j.kernel.EmbeddedGraphDatabase at org.neo4j.kernel.InternalAbstractGraphDatabase.run(InternalAbstractGraphDatabase.java:335) at org.neo4j.kernel.EmbeddedGraphDatabase.(EmbeddedGraphDatabase.java:59) at org.neo4j.graphdb.factory.GraphDatabaseFactory.newDatabase(GraphDatabaseFactory.java:108) at org.neo4j.graphdb.factory.GraphDatabaseFactory$1.newDatabase(GraphDatabaseFactory.java:95) at org.neo4j.graphdb.factory.GraphDatabaseBuilder.newGraphDatabase(GraphDatabaseBuilder.java:176) at org.neo4j.graphdb.factory.GraphDatabaseFactory.newEmbeddedDatabase(GraphDatabaseFactory.java:67) at com.tpgsi.mongodb.dataPollingWithOplog.ORBCreateLink.main(ORBCreateLink.java:62) Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.kernel.StoreLockerLifecycleAdapter@5b6ca687' was successfully initialized, but failed to start. Please see attached cause exception. at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:513) at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:115) at org.neo4j.kernel.InternalAbstractGraphDatabase.run(InternalAbstractGraphDatabase.java:331) ... 6 more Caused by: org.neo4j.kernel.StoreLockException: Unable to obtain l file: /home/aps/neo4j-community-2.2.3/CompleteTest/store_lock. Please ensure no other process is using this database, and that the directory is writable (required even for read-only access) at org.neo4j.kernel.StoreLocker.checkLock(StoreLocker.java:78) at org.neo4j.kernel.StoreLockerLifecycleAdapter.start(StoreLockerLifecycleAdapter.java:44) at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:507) ... 8 more Caused by: java.nio.channels.OverlappingFileLockException at sun.nio.ch.SharedFileLockTable.checkList(FileLockTable.java:255) at sun.nio.ch.SharedFileLockTable.add(FileLockTable.java:152) at sun.nio.ch.FileChannelImpl.tryLock(FileChannelImpl.java:1087) at java.nio.channels.FileChannel.tryLock(FileChannel.java:1154) at org.neo4j.io.fs.StoreFileChannel.tryLock(StoreFileChannel.java:135) at org.neo4j.io.fs.FileLock.wrapFileChannelLock(FileLock.java:38) at org.neo4j.io.fs.FileLock.getOsSpecificFileLock(FileLock.java:99) at org.neo4j.io.fs.DefaultFileSystemAbstraction.tryLock(DefaultFileSystemAbstraction.java:85) at org.neo4j.kernel.StoreLocker.checkLock(StoreLocker.java:74)
I have one process which will create graph and on completion of this i have one more process to create few more relationship on top of if. But i am getting above exception while running the second process after completion of first process. I checked the data directory of Neo4j is not been used by any process but still getting lock issue.
I ran once a piece of code to create the graph.
static GraphDatabaseFactory dbFactory = null;
static GraphDatabaseService graphdb = null;
static{
dbFactory =new GraphDatabaseFactory();
graphdb = dbFactory.newEmbeddedDatabase(com.tpgsi.mongodb.dataPollingWithOplog.CommonConstants.NEO4J_DATA_DIRECTORY);
}
try{
Transaction tx = graphdb.beginTx();
try
{
// creating Node and relationships
tx.success();
} catch (Exception e) {
tx.failure();
e.printStackTrace();
} finally {
tx.close();
}
}
catch(Exception e)
{
e.printStackTrace();
}
I have created graphdb object as global variable and using that everywhere. Only transaction, i am closing. I am not using registerShutDownHook() and shutdown function for graphdb object. The reason i am not using these functions are because, i am running this in storm environment with multiple executors and if we will shutdown this then for every thread i have to create it again which is also not good. I am thinking not shutting down the graphdb could be the reason. If i am running the same code with One executor it works fine but with multiple executor getting Lock issue. Can anybody tell me what i have to do to get ride of it.