lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Otis Gospodnetic <otis_gospodne...@yahoo.com>
Subject Re: Index locked exception while updating index
Date Mon, 18 Jul 2005 04:33:36 GMT
Harini,

You are catching IOException in the finally block, but you are not even
printing out the exception stack trace.  Perhaps you are not able to
close your IndexWriter for some reason.

Otis


--- Harini Raghavan <harini.raghavan@insideview.com> wrote:

> 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 
> listener.
> 
>  public void addDocument(Document doc) {
>      String indexLoc = luceneConfig.getIndexDir();
>      IndexWriter writer = getIndexWriter(indexLoc, false);
>      try{
>           writer.addDocument(doc);
>      } catch(IOException e) {
>             logger.error("IOException occurred in addDocument()");
>      } catch(Exception e) {
>             logger.error("Exception occurred in addDocument()");
>      } finally {
>             try {
>                 writer.close();
>            } catch(IOException e){
>     }
> }
> 
> The incremental update works fine twice and the third time it throws
> the 
> following exception :
> 
> java.io.IOException: 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(LuceneActions.java:151)
> at lucene.LuceneActions.addDocument(LuceneActions.java:43)
> at index.IndexServiceImpl.addData(IndexServiceImpl.java:63)
> at index.IndexServiceImpl.addToIndex(IndexServiceImpl.java:28)
> 
> 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.
> Thanks,
> Harini 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message