我目前正在运行grails 2.3.3 with' in memory' H2数据库。我经常得到一个已经关闭的联合连接'尝试调出特定视图时出错。它始终是相同的视图,但是间歇性的,因为有时视图会成功显示。
以下是日志中的错误消息:
PooledConnection已经关闭.. Stacktrace如下: org.codehaus.groovy.grails.web.pages.exceptions.GroovyPagesException:处理GroovyPageView时出错:无法加载实体:[homevu1.MusicShr#97] at grails.plugin.cache.web.filter.PageFragmentCachingFilter.doFilter(PageFragmentCachingFilter.java:200) at grails.plugin.cache.web.filter.AbstractFilter.doFilter(AbstractFilter.java:63) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:603) 在java.lang.Thread.run(Thread.java:722) 引起:org.hibernate.exception.GenericJDBCException:无法加载实体:[homevu1.MusicShr#97] 在C__grails_workspace_rel_3_1_0_HomeVu1_grails_app_views_videoTemplateAdminShr_show_gsp $ _run_closure2.doCall(show.gsp:123) at C__grails_workspace_rel_3_1_0_HomeVu1_grails_app_views_videoTemplateAdminShr_show_gsp.run(show.gsp:151) ......还有5个 引起:java.sql.SQLException:PooledConnection已经关闭。 ......还有7个 rCaused by:java.sql.SQLException:PooledConnection已经关闭。 ......还有7个
我已经对此进行了一些在线调查,也许我可以尝试使用H2池配置设置。目前,设置是简单的默认设置 -
以下是Datasource.groovy的部分:
dataSource {
pooled = true
driverClassName = "org.h2.Driver"
username = "****"
password = "*****"
}
hibernate {
cache.use_second_level_cache = true
cache.use_query_cache = false
cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory'
}
// environment specific settings
environments {
development {
dataSource {
dbCreate = "update" // one of 'create', 'create-drop', 'update', 'validate', ''
url = "jdbc:h2:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000"
}
//
//****************************
// using h2 devdb
//***************************
//
dataSource_publish {
dbCreate = "update" // one of 'create', 'create-drop', 'update', 'validate', ''
url = "jdbc:h2:/dbmak/devDb;MVCC=TRUE;LOCK_TIMEOUT=10000;AUTO_SERVER=TRUE;DB_CLOSE_ON_EXIT=FALSE"
}
}
我欢迎一些建议?