Did you close your writer if an Exception occured?
I had a similiar problem, but it was fixed when i close the writer in the
finally block.
Below is my original code (which generate Mjava.io.Exception: Lock obtain
timed out when an Exception is thrown)
public static void index(File indexDir, List cList, boolean ow)
throws Exception{
IndexWriter writer = null;
try{
writer = new IndexWriter(indexDir, new MyAnalyzer(), overwrite);
// index documents
}
catch(Exception e){
writer = new IndexWriter(indexDir, new MyAnalyzer(), true);
try{
// index documents
}
catch(Exception ee){
throw ee;
}
}
writer.close(); // never reaches this statement if the catch block is
called.
}
// revised code to force a close on the IndexWriter
public static void index(File indexDir, List cList, boolean ow)
throws Exception{
IndexWriter writer = null;
try{
writer = new IndexWriter(indexDir, new MyAnalyzer(), overwrite);
// index documents
writer.close();
}
catch(Exception e){
writer = new IndexWriter(indexDir, new MyAnalyzer(), true);
try{
// index documents
}
catch(Exception ee){
throw ee;
}
finally{
writer.close();
}
}
}
-Original Message-
From: Gabe [mailto:[EMAIL PROTECTED]
Sent: Monday, March 15, 2004 1:53 PM
To: Lucene Users List
Subject: Re: java.io.IOException: Lock obtain timed out
Otis,
I only put the unlock call in because I had the error
in the first place. Removing it, the IOException still
occurs, when trying to instantiate the IndexWriter.
Thanks,
Gabe
--- Otis Gospodnetic <[EMAIL PROTECTED]>
wrote:
> There is no need for that .unlock call, just
> .close()
>
> Otis
>
> --- Gabe <[EMAIL PROTECTED]> wrote:
> >
> > I am using Lucene 1.3 final and am having an error
> > that I can't seem to shake. Basically, I am
> updating a
> > Document in the index incrementally by calling an
> > IndexReader to remove the document. This works.
> Then,
> > I close the IndexReader with the following code:
> >
> > reader.unlock(reader.directory());
> > reader.close();
> >
> > I put the first of the two lines in to try to
> force
> > the lock to disable. According to the logging,
> this
> > code is being called and the IndexReader is being
> > closed.
> >
> > However, then I open a writer to add the document,
> I
> > get the following.
> >
> > java.io.IOException: Lock obtain timed out
> > at
> > org.apache.lucene.store.Lock.obtain(Lock.java:97)
> > at
> >
>
org.apache.lucene.index.IndexWriter.(IndexWriter.java:173)
> > at
> >
> > ...
> >
> > I open the writer by calling:
> > return new IndexWriter(INDEX_DIR, analyzer,
> false);
> >
> > where analyzer=new StandardAnalyzer();
> >
> > I get the reader by calling:
> > IndexReader reader=IndexReader.open(INDEX_DIR);
> >
> > Thanks for any help,
> > Gabe
> >
> > __
> > Do you Yahoo!?
> > Yahoo! Mail - More reliable, more storage, less
> spam
> > http://mail.yahoo.com
> >
> >
>
-
> > To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> > For additional commands, e-mail:
> [EMAIL PROTECTED]
> >
>
>
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
>
__
Do you Yahoo!?
Yahoo! Mail - More reliable, more storage, less spam
http://mail.yahoo.com
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]