We use Hibernate Search in our web application and following are releases which we are using:
hibernate-search-3.4.1.Final
hibernate3.6.10.jar
lucene-core-3.4.0.jar
Previously we had lucene-core-3.1
but upgraded a couple of months ago because of another issue. Now I am getting following error very often. I searched the net and found this and this and a couple of others but they don't seem to be same as mine. Here is the stack trace:
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)
Any help is much appreciated.
Did you check your index folder for the specified entity? Also you can check your entity index's by using luke tool. For details https://lucene.apache.org/core/3_5_0/contributions.html
Its seems the index file is not present in the location. Please verify the below location.
\\sql-cluster\\data\\indexes\\mycomp.domain.Item_1ut.cfs
While loading the context it looks for the index location.
Most likely your index file is corrupted.
or
Your new hibernate lucene library pointing the wrong index path.
To Solve this issue you need to recreate the index something like below.
FullTextSession session = Search.getFullTextSession(getSessionFactory().openSession());
session.setFlushMode(FlushMode.MANUAL);
session.setCacheMode(CacheMode.IGNORE);
Transaction transaction = session.beginTransaction();
ScrollableResults items = session.createQuery("from Item i ")
.scroll(ScrollMode.FORWARD_ONLY);
while(items.next()) {
Object nextToIndex = items.get(0);
session.index(nextToIndex);
session.flushToIndexes();
session.clear();
}
transaction.commit();
Hibernate Search 3.4.x requires Lucene version 3.1.x. See also https://repository.jboss.org/nexus/content/repositories/public/org/hibernate/hibernate-search-parent/3.4.1.Final/hibernate-search-parent-3.4.1.Final.pom .
You'll either need to downgrade Lucene again, or, if you want to use Lucene 3.4.x, you will need to upgrade Hibernate Search as well.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.