我們使用Hibernate Search的在我們的web應用程序和下面是我們使用的版本:FileNotFoundException異常在Hibernate中搜索和Lucene
hibernate-search-3.4.1.Final
hibernate3.6.10.jar
lucene-core-3.4.0.jar
以前我們有lucene-core-3.1
但升級了幾個月前,因爲另外一個問題。現在我經常遇到錯誤。我搜查了網絡,發現this和this和其他幾個人,但他們似乎不是我的一樣。這裏是堆棧跟蹤:
2013-09-29 15:10:43,624 ERROR LogErrorHandler:82 - Exception occurred java.io.FileNotFoundException: \\sql-cluster\data\indexes\mycomp.domain.Item\_1ut.cfs (The system cannot find the file specified)
Primary Failure:
Entity mycomp.domain.Item Id 4761556 Work Type org.hibernate.search.backend.AddLuceneWork
java.io.FileNotFoundException: \\sql-cluster\data\indexes\mycomp.domain.Item\_1ut.cfs (The system cannot find the file specified)
at java.io.RandomAccessFile.open(Native Method)
at java.io.RandomAccessFile.<init>(RandomAccessFile.java:233)
at org.apache.lucene.store.MMapDirectory.openInput(MMapDirectory.java:214)
at org.apache.lucene.index.CompoundFileReader.<init>(CompoundFileReader.java:64)
at org.apache.lucene.index.CompoundFileReader.<init>(CompoundFileReader.java:52)
at org.apache.lucene.index.IndexWriter.getFieldInfos(IndexWriter.java:1222)
at org.apache.lucene.index.IndexWriter.getCurrentFieldInfos(IndexWriter.java:1242)
at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:1175)
at org.hibernate.search.backend.Workspace.createNewIndexWriter(Workspace.java:202)
at org.hibernate.search.backend.Workspace.getIndexWriter(Workspace.java:180)
at org.hibernate.search.backend.impl.lucene.PerDPQueueProcessor.run(PerDPQueueProcessor.java:103)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
2013-09-29 15:10:43,624 ERROR PerDPQueueProcessor:118 - Unexpected error in Lucene Backend:
java.lang.NullPointerException
at org.hibernate.search.backend.impl.lucene.works.AddWorkDelegate.performWork(AddWorkDelegate.java:76)
at org.hibernate.search.backend.impl.lucene.PerDPQueueProcessor.run(PerDPQueueProcessor.java:106)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
2013-09-29 15:10:43,624 ERROR LogErrorHandler:82 - Exception occurred java.lang.NullPointerException
Primary Failure:
Entity mycomp.domain.Item Id 4761556 Work Type org.hibernate.search.backend.AddLuceneWork
java.lang.NullPointerException
at org.hibernate.search.backend.impl.lucene.works.AddWorkDelegate.performWork(AddWorkDelegate.java:76)
at org.hibernate.search.backend.impl.lucene.PerDPQueueProcessor.run(PerDPQueueProcessor.java:106)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
任何幫助,非常感謝。
感謝您的回覆。我認爲如果索引文件被破壞,它總是會不時發生。糾正我,如果我錯了。 –
當然可以。不過你可以通過@ashokkuttuva提到的工具檢查索引。 – Prabhakaran