0
如果我將運行這個休眠搜索程序第一次運行正常,而如果我編譯它第二次就產生一個錯誤:Hibernate Search的程序錯誤,只在第二編譯
ERROR: HSEARCH000058: Exception occurred org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out: [email protected]:\data\index\com.srccodes.example.hibernate.Contact\write.lock
Primary Failure:
Entity com.srccodes.example.hibernate.Contact Id null Work Type org.hibernate.search.backend.PurgeAllLuceneWork
org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out: [email protected]:\data\index\com.srccodes.example.hibernate.Contact\write.lock
at org.apache.lucene.store.Lock.obtain(Lock.java:84)
at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:1108)
at org.hibernate.search.backend.impl.lucene.IndexWriterHolder.createNewIndexWriter(IndexWriterHolder.java:127)
at org.hibernate.search.backend.impl.lucene.IndexWriterHolder.getIndexWriter(IndexWriterHolder.java:102)
at org.hibernate.search.backend.impl.lucene.AbstractWorkspaceImpl.getIndexWriter(AbstractWorkspaceImpl.java:119)
at org.hibernate.search.backend.impl.lucene.LuceneBackendQueueTask.applyUpdates(LuceneBackendQueueTask.java:99)
at org.hibernate.search.backend.impl.lucene.LuceneBackendQueueTask.run(LuceneBackendQueueTask.java:67)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
[LockObtainFailedException使用solr更新Lucene搜索索引]的可能重複(http://stackoverflow.com/questions/5327978/lockobtainfailedexception-updating-lucene-search-index-using-solr) - 我懷疑你忘記關閉在嘗試打開第二個之前的第一個句柄。 –