lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Harini Raghavan" <>
Subject Index locked exception while updating index
Date Sun, 17 Jul 2005 14:05:43 GMT
Hi All,
I am quite new to Lucene and I have problem with locking. I have a 
MessageDrivenBean that sends messages to my Lucene indexer whenever there is 
a  new database update. The indexer updates the index incrementally . Below 
is the code fragment in the indexer method that gets invoked by the MDB 

 public void addDocument(Document doc) {
     String indexLoc = luceneConfig.getIndexDir();
     IndexWriter writer = getIndexWriter(indexLoc, false);
     } catch(IOException e) {
            logger.error("IOException occurred in addDocument()");
     } catch(Exception e) {
            logger.error("Exception occurred in addDocument()");
     } finally {
            try {
           } catch(IOException e){

The incremental update works fine twice and the third time it throws the 
following exception : Index locked for write: Lock@C:\tmpIndex\write.lock
at org.apache.lucene.index.IndexWriter.<init>(Unknown Source)
at org.apache.lucene.index.IndexWriter.<init>(Unknown Source)
at lucene.LuceneActions.getIndexWriter(
at lucene.LuceneActions.addDocument(
at index.IndexServiceImpl.addData(
at index.IndexServiceImpl.addToIndex(

The Index Writer is created every time and also closed in the finally block. 
Should I be doing something else?
Any help would be appreciated.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message