sim51/logisima-play-neo4j — Issue #1: Index has been shut down : exception
Author: jph303
Created: 2012-01-10 13:01:20+00:00
State: open

Whilst playing around with using indexes in the test application, I get this error every now and then. It requires me to restart the application to resolve it. I have seen it with both the USER_KEY index and the lastname index added via annotation.

Execution exception (In /app/models/User.java around line 42)
IllegalStateException occured : Index has been shut down

play.exceptions.JavaExecutionException: Index has been shut down
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:231)
at Invocation.HTTP Request(Play!)
Caused by: java.lang.IllegalStateException: Index has been shut down
at org.neo4j.index.impl.lucene.LuceneDataSource.getIndexWriter(LuceneDataSource.java:573)
at org.neo4j.index.impl.lucene.LuceneDataSource.getIndexSearcher(LuceneDataSource.java:489)
at org.neo4j.index.impl.lucene.LuceneIndex.query(LuceneIndex.java:248)
at org.neo4j.index.impl.lucene.LuceneIndex.query(LuceneIndex.java:207)
at models.User.findAll(User.java:42)
at controllers.Application.index(Application.java:13)
at play.mvc.ActionInvoker.invokeWithContinuation(ActionInvoker.java:548)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:502)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:478)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:473)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:161)
... 1 more

The method I am using the indexes with is:

public static List findAll()
{
List users = new ArrayList();
IndexManager index = Neo4j.db().index();
Index userIndex = index.forNodes("USER_KEY");
if(userIndex != null)
{
IndexHits userNodes = userIndex.query("key", "*");
if(userNodes != null && userNodes.size() > 0)
{
for(Node node: userNodes)
{
User user = null;
try
{
user = User.getByKey(((Long)node.getProperty("key")).longValue());
}
catch (Neo4jException e)
{
Logger.error(e.getMessage(), e);
}
if(user!= null)
{
users.add(user);
}
}
}
}
return users;
}