lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "S Edirisinghe" <edirisingh...@gmail.com>
Subject opening an IndexWriter for an exisiting index causing lock exception
Date Mon, 08 Jan 2007 22:48:13 GMT
Hello,

I'm having a write lock problem when I try to open an existing index.
When I try to open the index with the recreate set to false, I get this
exception

java.io.IOException: Lock obtain timed out: Lock@/tmp/lucene-
e683c0b3e52b8094bba62b22617efd41-write.lock
    at org.apache.lucene.store.Lock.obtain(Lock.java:58)
    at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:255)
    at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:205)
    at im.service.search.impl.InfomunityLuceneIndexManager.openIndex(
InfomunityLuceneIndexManager.java:108)
    at im.service.search.impl.InfomunityLuceneIndexManager.<init>(
InfomunityLuceneIndexManager.java:71)
    at im.service.search.impl.test.InfomunityLuceneIndexManagerTest.<init>(
InfomunityLuceneIndexManagerTest.java:31)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(
NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
    at org.junit.internal.runners.TestClassMethodsRunner.createTest(
TestClassMethodsRunner.java:60)

when I try to open it. If I open it with recreate set to false, it opens
fine, but obviously it destroys the exisiting files. This error happens at
the start of the application. the first thing it starts to do is
...
            try{
                openIndex(false);
            } catch (IOException fe){//if there is no index or it is
incomplete we will have to rebuild it
                log.info("rebuilding index: " + infomunity.getName() + "
id=" + infomunity.getId());

                String msg = "could not open index for " +
infomunity.getName() +
                "\n\t" + fe.getMessage();
                StringWriter sw = new StringWriter() ;
                PrintWriter stackWriter = new PrintWriter( sw );
                fe.printStackTrace(stackWriter);

                log.error(msg + "\n\n" + sw.toString());
            }
...
    private synchronized IndexWriter openIndex(boolean recreate) throws
IOException{
        return (indexWriter = new IndexWriter(path,new
KeywordAnalyzer(),recreate));
    }

All I'm doing is calling open. There is no documents being added. Is there
something I'm missing? At the time I start the application there are no lock
files in the tmp directory.

thanks

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message