我在我的grails 1.3.7项目中使用的是searchable插件。我的项目运行得很好,直到我的macbook硬盘满了,osx抛出了一个关于内存问题的消息,它会删除一些文件(tmp等)(在那之后,我删除了一些电影,得到了超过10GB的可用空间)。我没有改变源代码,但当我现在启动我的grails应用程序时,我得到以下异常:
Running Grails application..
Configuring Spring Security ...
Configuring SpringSocial Facebook
2011-11-18 01:54:16,804 [main] ERROR context.GrailsContextLoader - Error executing bootstraps: Failed to retrieve transaction locks; nested exception is java.io.IOException: Permission denied
org.compass.core.engine.SearchEngineException: Failed to retrieve transaction locks; nested exception is java.io.IOException: Permission denied
java.io.IOException: Permission denied
at java.io.UnixFileSystem.createFileExclusively(Native Method)
at java.io.File.createNewFile(File.java:883)
at org.apache.lucene.store.SimpleFSLock.obtain(SimpleFSLockFactory.java:144)
at org.apache.lucene.store.Lock.obtain(Lock.java:73)
at org.compass.core.lucene.engine.manager.DefaultLuceneSearchEngineIndexManager$6.doInTransaction(DefaultLuceneSearchEngineIndexManager.java:203)
at org.compass.core.impl.DefaultCompass$CompassTransactionContext.execute(DefaultCompass.java:423)
at org.compass.core.lucene.engine.manager.DefaultLuceneSearchEngineIndexManager.doOperate(DefaultLuceneSearchEngineIndexManager.java:197)
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 grails.plugin.searchable.internal.compass.CompassGpsUtils$index.call(Unknown Source)
at SearchableGrailsPlugin$_closure3.doCall(SearchableGrailsPlugin.groovy:158)
at org.grails.tomcat.TomcatServer.start(TomcatServer.groovy:212)
at grails.web.container.EmbeddableServer$start.call(Unknown Source)
at _GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy:158)
at _GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy)
at _GrailsSettings_groovy$_run_closure10.doCall(_GrailsSettings_groovy:280)
at _GrailsSettings_groovy$_run_closure10.call(_GrailsSettings_groovy)
at _GrailsRun_groovy$_run_closure5.doCall(_GrailsRun_groovy:149)
at _GrailsRun_groovy$_run_closure5.call(_GrailsRun_groovy)
at _GrailsRun_groovy.runInline(_GrailsRun_groovy:116)
at _GrailsRun_groovy.this$4$runInline(_GrailsRun_groovy)
at _GrailsRun_groovy$_run_closure1.doCall(_GrailsRun_groovy:59)
at RunApp$_run_closure1.doCall(RunApp:33)
at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381)
at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415)
at gant.Gant$_dispatch_closure7.doCall(Gant.groovy)
at gant.Gant.withBuildListeners(Gant.groovy:427)
at gant.Gant.this$2$withBuildListeners(Gant.groovy)
at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
at gant.Gant.dispatch(Gant.groovy:415)
at gant.Gant.this$2$dispatch(Gant.groovy)
at gant.Gant.invokeMethod(Gant.groovy)
at gant.Gant.executeTargets(Gant.groovy:590)
at gant.Gant.executeTargets(Gant.groovy:589)
Application context shutting down...
Application context shutdown.
我认为在文件系统中lucene索引有问题,但我在哪里可以找到它?lucene索引文件夹或文件存储在哪里?我没有更改插件的配置
根据默认的配置文件
/**
* The location of the Compass index
*
* Examples: "/home/app/compassindex", "ram://app-index" or null to use the default
*
* The default is "${user.home}/.grails/projects/${app.name}/searchable-index/${grails.env}"
*/
所以除非你改变了它(你说你没有),否则我会在
中查看一下。~/.grails/projects/${app.name}/searchable-index/${grails.env}
我的tomcat安装在${user.home}/.grails/projects/${app.name}/search_index目录下,请记住tomcat进程可能是在不同的用户下运行的,所以我运行"sudo nautilus"来查看它
看起来像是某种Unix/OS X权限问题。当Searchable/Lucene启动并尝试创建索引时,它做的第一件事是在索引目录中创建一个锁文件。从堆栈跟踪来看,这就是失败的地方。
Searchable.groovy
文件是定义索引路径的地方;它有可能在environment
块中被覆盖,甚至可能在Config.groovy
中被覆盖。
grails run-app
作为您的用户运行Grails,因此问题与Tomcat作为不同用户运行无关。