When using hibernate-search3.1.0 GA, Search throws AlreadyClosedException under certain circumstances

Description

The below code throws an AlreadyClosedException when trying to open the lucene index. Junit test to test it works from eclipse, fails in an ant build.
I suspect it is trying to reuse a handle to the index. Please let me know if you need more information.

I had to bump back my hibernate search version to 3.0.1 GA, and then it started working. I am getting by, but would ideally like to use 3.1.0 GA without this exception. I think it has something to do with Search.getFullTextEntityManager((getJpaPersistenceContext().getEntityManager())); VS Search.createFullTextEntityManager((getJpaPersistenceContext().getEntityManager())); in the older version.

String query = "BlahBlahBlah";
org.apache.lucene.queryParser.QueryParser parser = new QueryParser("ItemTitle", new StandardAnalyzer() );
org.apache.lucene.search.Query luceneQuery;
try {
luceneQuery = parser.parse(query);
} catch (ParseException e) {
// TODO Auto-generated catch block
logger.error(String.format("Error parsing search querystring "));
return null;
}
javax.persistence.Query fullTextQuery = createFullTextEntityManager().createFullTextQuery(luceneQuery, klass);
List result = fullTextQuery.getResultList(); // return a list of managed

where createFullTextEntityManager() is

public FullTextEntityManager createFullTextEntityManager() {
return Search.getFullTextEntityManager((getJpaPersistenceContext().getEntityManager()));
}

Activity

Show:

Emmanuel Bernard April 8, 2010 at 5:08 PM

No user feedback

Sanne Grinovero April 26, 2009 at 8:39 AM

Hi, Search 3.1.0.GA requires Hibernate 3.3.x
Could you verify you still experience the problem after correcting the versions?
Having it working in eclipse makes me think you are using different versions than when running by ant.

Cannot Reproduce

Details

Assignee

Reporter

Affects versions

Priority

Created April 21, 2009 at 8:14 PM
Updated July 1, 2010 at 12:42 PM
Resolved April 8, 2010 at 5:08 PM

Flag notifications