I'm using Lucene.NET, but I had a similar issue with Visual Studio. With Visual Studio open, my application would randomly crash with the same error when I tried to run it from the command line. I'd recommend shutting down all running apps and then see if the error happens in Ant. You could also try writing to a different index directory, outside of your application folder.
Monsur > -----Original Message----- > From: Matt Magoffin [mailto:[EMAIL PROTECTED] > Sent: Friday, May 06, 2005 9:44 PM > To: java-user@lucene.apache.org > Subject: Intermittent exception on optimize(): IOException: > Cannot delete _5.cfs > > I'm getting a strange exception with Lucene 1.4.3 that occurs > when I run a > unit test from Ant, but not when I run the same unit test > inside Eclipse. > The exception is > > Caused by: java.io.IOException: Cannot delete _5.cfs > at > org.apache.lucene.store.FSDirectory.renameFile(FSDirectory.java:232) > at org.apache.lucene.index.IndexWriter$5.doBody(IndexWriter.java:651) > at org.apache.lucene.store.Lock$With.run(Lock.java:109) > at > org.apache.lucene.index.IndexWriter.mergeSegments(IndexWriter. > java:648) > at > org.apache.lucene.index.IndexWriter.flushRamSegments(IndexWrit > er.java:575) > at org.apache.lucene.index.IndexWriter.optimize(IndexWriter.java:468) > ... > > This occurs within a block of code that has exclusive access > to the index > at the time of the exception, and right after re-creating the > index (via > opening a new IndexWriter with the create parameter set to 'true'). > > I can't get the error to happen every time, but if I run the unit test > enough times the exception will happen eventually. If I > re-run the unit > test after the error occurs, then a different exception gets > thrown when > trying to open an IndexReader on this index: > > java.lang.ArrayIndexOutOfBoundsException: -1 > at java.util.ArrayList.get(ArrayList.java:324) > at org.apache.lucene.index.FieldInfos.fieldInfo(FieldInfos.java:155) > at org.apache.lucene.index.FieldInfos.fieldName(FieldInfos.java:151) > at > org.apache.lucene.index.SegmentTermEnum.readTerm(SegmentTermEn > um.java:149) > at > org.apache.lucene.index.SegmentTermEnum.next(SegmentTermEnum.java:115) > at > org.apache.lucene.index.TermInfosReader.readIndex(TermInfosRea > der.java:86) > at > org.apache.lucene.index.TermInfosReader.<init>(TermInfosReader > .java:45) > at > org.apache.lucene.index.SegmentReader.initialize(SegmentReader > .java:112) > at > org.apache.lucene.index.SegmentReader.<init>(SegmentReader.java:94) > at org.apache.lucene.index.IndexReader$1.doBody(IndexReader.java:122) > at org.apache.lucene.store.Lock$With.run(Lock.java:109) > at org.apache.lucene.index.IndexReader.open(IndexReader.java:111) > at org.apache.lucene.index.IndexReader.open(IndexReader.java:106) > ... > > which I'm assuming occurs because the index has become > corrupted somehow, > possibly during the .optimize() call? > > Any ideas are greatly appreciated. > > > --------------------------------------------------------------------- > 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]