grails、Searchable问题:报此错的原因是因为文件缓存空间冲突;

罗华翰
2023-12-01

2013-08-01 12:38:48,484 [localhost-startStop-1] ERROR StackTrace  - Full Stack Trace:

org.compass.core.engine.SearchEngineException: Failed to rename index [C:\Documents and Settings\Administrator\.grails\projects\talentExchange\searchable-index\production/index/t_base] to [C:\Documents and Settings\Administrator\.grails\projects\talentExchange\searchable-index\production\index\t_base-copy0]

at org.compass.core.lucene.engine.store.FSDirectoryStore.beforeCopyFrom(FSDirectoryStore.java:157)

at org.compass.core.lucene.engine.store.DefaultLuceneSearchEngineStore.copyFrom(DefaultLuceneSearchEngineStore.java:616)

at org.compass.core.lucene.engine.store.DefaultLuceneSearchEngineStore.copyFrom(DefaultLuceneSearchEngineStore.java:602)

at org.compass.core.lucene.engine.manager.DefaultLuceneSearchEngineIndexManager$ReplaceIndexOperationCallback$1$1.run(DefaultLuceneSearchEngineIndexManager.java:298)

at org.compass.core.lucene.engine.manager.IndexHoldersCache.doUnderCacheLock(IndexHoldersCache.java:126)

at org.compass.core.lucene.engine.manager.DefaultLuceneSearchEngineIndexManager$ReplaceIndexOperationCallback$1.doInTransaction(DefaultLuceneSearchEngineIndexManager.java:294)

at org.compass.core.impl.DefaultCompass$CompassTransactionContext.execute(DefaultCompass.java:423)

at org.compass.core.lucene.engine.manager.DefaultLuceneSearchEngineIndexManager$ReplaceIndexOperationCallback.secondStep(DefaultLuceneSearchEngineIndexManager.java:290)

at org.compass.core.lucene.engine.manager.DefaultLuceneSearchEngineIndexManager.doOperate(DefaultLuceneSearchEngineIndexManager.java:248)

at org.compass.core.lucene.engine.manager.DefaultLuceneSearchEngineIndexManager.doReplaceIndex(DefaultLuceneSearchEngineIndexManager.java:266)

at org.compass.core.lucene.engine.manager.DefaultLuceneSearchEngineIndexManager.replaceIndex(DefaultLuceneSearchEngineIndexManager.java:261)

at org.compass.gps.impl.SingleCompassGps.doIndex(SingleCompassGps.java:118)

at org.compass.gps.impl.AbstractCompassGps.index(AbstractCompassGps.java:154)

at org.compass.gps.impl.AbstractCompassGps.index(AbstractCompassGps.java:128)

at grails.plugin.searchable.internal.compass.CompassGpsUtils.index(CompassGpsUtils.java:49)

at SearchableGrailsPlugin$_closure3.doCall(SearchableGrailsPlugin.groovy:158)

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)

at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)

at java.util.concurrent.FutureTask.run(FutureTask.java:138)

at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

at java.lang.Thread.run(Thread.java:662)

 

解决方法:

一、 执行grails install-searchable-config 只有执行此命令后会在当前项目grails-app/conf/中创建一个Searchable.groovy文件;打开Searchable.groovy

二、 修改searchable.groovy

compassConnection = new File(

"${userHome}/.grails/projects/${appName}/searchable-index/${grailsEnv}"

).absolutePath

 

修改为

String path =  System.getProperty("user.dir")   //ApplicationContext.getResource("/");

    path =  MD5Codec.encode(path);

    compassConnection = new File(

"${userHome}/.grails/projects/${appName}/searchable-index/${grailsEnv}${path}"

    ).absolutePath

大功告成

 类似资料: