我有一个2.1.1 grails应用程序,我使用grails run-war运行。它效果很好,可以运行很长一段时间,但在12到24小时后停止运行。当它失败时,我永远不会观察应用程序。它总是说“坏”
$ grails run-war
| Done creating WAR target/web-0.1.war
| Running Grails application
Tomcat Server running WAR (output written to: target/tomcat-out.txt)
| Server running. Browse to http://localhost:8090/web
bad
$
最后3次失败中有2次在输出文件中产生了这个:
2012-10-10 10:22:46,684 [localhost-startStop-2] ERROR loader.WebappClassLoader - The web application [/web] appears to have started a thread named [Poller SunPKCS11-Darwin] but has failed to stop it. This is very likely to create a memory leak.
2012-10-10 10:22:46,694 [localhost-startStop-2] ERROR loader.WebappClassLoader - The web application [/web] appears to have started a thread named [MongoCleaner1292971653] but has failed to stop it. This is very likely to create a memory leak.
但是大多数情况下,日志文件中没有任何内容。
即使没有人使用过webapp,即使它处于空闲状态,也会发生这种情况。正在使用的插件是:
runtime ":mongodb:1.0.0.GA"
runtime ":jquery:1.7.2"
compile ":jquery-ui:1.8.15"
runtime ":resources:1.2-RC1"
// Uncomment these (or add new ones) to enable additional resources capabilities
//runtime ":zipped-resources:1.0"
//runtime ":cached-resources:1.0"
//runtime ":yui-minify-resources:0.1.4"
build ":tomcat:$grailsVersion"
使用grails 2.0.4时,这个应用程序运行了数周没有失败。唯一的变化是升级到grails 2.1.1
有什么想法吗?
由于
编辑: 包括DataSource.groovy
dataSource {
pooled = true
driverClassName = "org.h2.Driver"
username = "sa"
password = ""
}
hibernate {
cache.use_second_level_cache = true
cache.use_query_cache = true
cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory'
}
// environment specific settings
environments {
development {
dataSource {
dbCreate = "create-drop" // one of 'create', 'create-drop', 'update', 'validate', ''
url = "jdbc:h2:mem:devDb;MVCC=TRUE"
}
}
test {
dataSource {
dbCreate = "update"
url = "jdbc:h2:mem:testDb;MVCC=TRUE"
}
}
production {
dataSource {
dbCreate = "update"
url = "jdbc:h2:prodDb;MVCC=TRUE"
pooled = true
properties {
maxActive = -1
minEvictableIdleTimeMillis=1800000
timeBetweenEvictionRunsMillis=1800000
numTestsPerEvictionRun=3
testOnBorrow=true
testWhileIdle=true
testOnReturn=true
validationQuery="SELECT 1"
}
}
}
}
然后在每个模型中,
class Album {
static mapWith = "mongo"
我这样做是为了确保每次升级grails时都使用Mongo,它会自动重新安装hibernate插件,即使我一直在卸载它。
由于