我们的Grails应用程序中有一个Hibernate / JDBC连接到入口db:
dataSource {
dbCreate = 'validate'
url = "jdbc:ingres://xxx.xxx.xxx.xxx:II7/test"
driverClassName = "com.ingres.jdbc.IngresDriver"
username = "ingres"
password = "ingres"
jmxEnabled = true
initialSize = 5
maxActive = 50
minIdle = 5
maxIdle = 25
maxWait = 10000
maxAge = 10 * 60000
timeBetweenEvictionRunsMillis = 5000
minEvictableIdleTimeMillis = 60000
validationQuery = "SELECT 1"
validationQueryTimeout = 3
validationInterval = 15000
testOnBorrow = true
testWhileIdle = true
testOnReturn = true
jdbcInterceptors = "ConnectionState"
defaultTransactionIsolation = java.sql.Connection.TRANSACTION_READ_COMMITTED
}
我们的数据库崩溃了,我们不得不重启它。从那以后我们得到了几个错误,虽然我们可以从SQL工具访问ingres数据库,但Grails应用程序无法恢复。
我们能做什么的任何想法?像失败时重新连接的东西?
当我们访问页面或通过hibernate接触数据库的任何其他操作时,我们会记录以下日志:
[13 Jan 2016 13:28:31,492] org.hibernate.engine.jdbc.spi.SqlExceptionHelper [ERROR] - Connection failed.
[13 Jan 2016 13:28:31,492] org.hibernate.engine.jdbc.spi.SqlExceptionHelper [ERROR] - Read timed out
[13 Jan 2016 13:28:31,648] org.codehaus.groovy.grails.web.errors.GrailsExceptionResolver [ERROR] - SQLTransactionRollbackException occurred when processing request: [GET] /test/myDomain/show/21
Connection failed.. Stacktrace follows:
java.sql.SQLTransactionRollbackException: Connection failed.
at org.grails.datastore.gorm.GormStaticApi.findWhere(GormStaticApi.groovy:622)
at net.some.test.lvb.myDomainController.show(myDomainController.groovy:47)
at grails.plugin.cache.web.filter.PageFragmentCachingFilter.doFilter(PageFragmentCachingFilter.java:198)
at grails.plugin.cache.web.filter.AbstractFilter.doFilter(AbstractFilter.java:63)
[13 Jan 2016 13:28:32,961] org.hibernate.engine.jdbc.spi.SqlExceptionHelper [ERROR] - Connection closed.
[13 Jan 2016 13:28:33,008] org.codehaus.groovy.grails.web.errors.GrailsExceptionResolver [ERROR] - SQLNonTransientConnectionException occurred when processing request: [PUT] /test/myDomain/update/21
Connection closed.. Stacktrace follows:
java.sql.SQLNonTransientConnectionException: Connection closed.
at net.some.test.lvb.myDomainController.withmyDomain(myDomainController.groovy:82)
at net.some.test.lvb.myDomainController$_closure2.doCall(myDomainController.groovy:34)
at grails.plugin.cache.web.filter.PageFragmentCachingFilter.doFilter(PageFragmentCachingFilter.java:198)
at grails.plugin.cache.web.filter.AbstractFilter.doFilter(AbstractFilter.java:63)
[13 Jan 2016 13:28:37,727] org.hibernate.engine.jdbc.spi.SqlExceptionHelper [ERROR] - Connection closed.
[13 Jan 2016 13:28:37,727] org.codehaus.groovy.grails.web.errors.GrailsExceptionResolver [ERROR] - SQLNonTransientConnectionException occurred when processing request: [PUT] /test/myDomain/update/21
Connection closed.. Stacktrace follows:
java.sql.SQLNonTransientConnectionException: Connection closed.
at net.some.test.lvb.myDomainController.withmyDomain(myDomainController.groovy:82)
at net.some.test.lvb.myDomainController$_closure2.doCall(myDomainController.groovy:34)
at grails.plugin.cache.web.filter.PageFragmentCachingFilter.doFilter(PageFragmentCachingFilter.java:198)
at grails.plugin.cache.web.filter.AbstractFilter.doFilter(AbstractFilter.java:63)
[13 Jan 2016 13:28:46,930] org.hibernate.engine.jdbc.spi.SqlExceptionHelper [ERROR] - Connection closed.
[13 Jan 2016 13:28:46,961] org.codehaus.groovy.grails.web.errors.GrailsExceptionResolver [ERROR] - SQLNonTransientConnectionException occurred when processing request: [GET] /test/
Connection closed.. Stacktrace follows:
java.sql.SQLNonTransientConnectionException: Connection closed.
at grails.orm.PagedResultList.<init>(PagedResultList.java:43)
at grails.orm.HibernateCriteriaBuilder.createPagedResultList(HibernateCriteriaBuilder.java:163)
at net.some.test.lvb.myDomainController$_closure1.doCall(myDomainController.groovy:19)
at net.some.test.lvb.myDomainController.index(myDomainController.groovy:14)
at grails.plugin.cache.web.filter.PageFragmentCachingFilter.doFilter(PageFragmentCachingFilter.java:198)
at grails.plugin.cache.web.filter.AbstractFilter.doFilter(AbstractFilter.java:63)
[13 Jan 2016 13:28:51,883] org.hibernate.engine.jdbc.spi.SqlExceptionHelper [ERROR] - Connection closed.
[13 Jan 2016 13:28:51,883] org.codehaus.groovy.grails.web.errors.GrailsExceptionResolver [ERROR] - SQLNonTransientConnectionException occurred when processing request: [GET] /test/;jsessionid=
Connection closed.. Stacktrace follows:
java.sql.SQLNonTransientConnectionException: Connection closed.
at grails.orm.PagedResultList.<init>(PagedResultList.java:43)
at grails.orm.HibernateCriteriaBuilder.createPagedResultList(HibernateCriteriaBuilder.java:163)
at net.some.test.lvb.myDomainController$_closure1.doCall(myDomainController.groovy:19)
at net.some.test.lvb.myDomainController.index(myDomainController.groovy:14)
at grails.plugin.cache.web.filter.PageFragmentCachingFilter.doFilter(PageFragmentCachingFilter.java:198)
at grails.plugin.cache.web.filter.AbstractFilter.doFilter(AbstractFilter.java:63)
[13 Jan 2016 13:29:01,008] grails.app.services.net.some.test.lvb.TaskExecuterService [DEBUG] - Started processing tasks.
[13 Jan 2016 13:29:01,008] org.hibernate.engine.jdbc.spi.SqlExceptionHelper [ERROR] - Connection closed.
[13 Jan 2016 13:29:01,008] org.springframework.transaction.support.TransactionTemplate [ERROR] - Application exception overridden by rollback exception
org.springframework.dao.DataAccessResourceFailureException: Hibernate operation: could not prepare statement; SQL [select this_.id as id1_1_0_, this_.version as version2_1_0_, this_.basis as basis3_1_0_, this_.changeDate as changeDa4_1_0_, this_.deleted as deleted5_1_0_, this_.name as name6_1_0_, this_.notice as notice7_1_0_, this_.referenceDate as referenc8_1_0_, this_.selector as selector9_1_0_, this_.specialIdentification as special10_1_0_, this_.turnus as turnus11_1_0_ from FA_myDomain this_]; Connection closed.; nested exception is java.sql.SQLNonTransientConnectionException: Connection closed.
at net.some.test.lvb.TaskExecuterService.processmyDomain(TaskExecuterService.groovy:66)
at net.some.test.lvb.TaskExecuterService.$tt__processTasks(TaskExecuterService.groovy:40)
at net.some.test.lvb.TaskExecuterJob.execute(TaskExecuterJob.groovy:10)
at grails.plugins.quartz.GrailsJobFactory$GrailsJob.execute(GrailsJobFactory.java:104)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
Caused by: java.sql.SQLNonTransientConnectionException: Connection closed.
... 6 more
[13 Jan 2016 13:29:01,024] org.quartz.core.JobRunShell [INFO] - Job GRAILS_JOBS.net.some.test.lvb.TaskExecuterJob threw a JobExecutionException:
org.quartz.JobExecutionException: org.springframework.transaction.TransactionSystemException: Could not roll back Hibernate transaction; nested exception is org.hibernate.TransactionException: rollback failed [See nested exception: org.springframework.transaction.TransactionSystemException: Could not roll back Hibernate transaction; nested exception is org.hibernate.TransactionException: rollback failed]
at grails.plugins.quartz.GrailsJobFactory$GrailsJob.execute(GrailsJobFactory.java:111)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
Caused by: org.springframework.transaction.TransactionSystemException: Could not roll back Hibernate transaction; nested exception is org.hibernate.TransactionException: rollback failed
at net.some.test.lvb.TaskExecuterJob.execute(TaskExecuterJob.groovy:10)
at grails.plugins.quartz.GrailsJobFactory$GrailsJob.execute(GrailsJobFactory.java:104)
... 2 more
Caused by: org.hibernate.TransactionException: rollback failed
... 4 more
Caused by: org.hibernate.TransactionException: unable to rollback against JDBC connection
... 4 more
Caused by: java.sql.SQLException: Invalid transaction state for requested operation.
... 4 more
[13 Jan 2016 13:29:01,024] grails.plugins.quartz.listeners.ExceptionPrinterJobListener [ERROR] - Exception occurred in job: Grails Job
org.quartz.JobExecutionException: org.springframework.transaction.TransactionSystemException: Could not roll back Hibernate transaction; nested exception is org.hibernate.TransactionException: rollback failed [See nested exception: org.springframework.transaction.TransactionSystemException: Could not roll back Hibernate transaction; nested exception is org.hibernate.TransactionException: rollback failed]
at grails.plugins.quartz.GrailsJobFactory$GrailsJob.execute(GrailsJobFactory.java:111)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
Caused by: org.springframework.transaction.TransactionSystemException: Could not roll back Hibernate transaction; nested exception is org.hibernate.TransactionException: rollback failed
at net.some.test.lvb.TaskExecuterJob.execute(TaskExecuterJob.groovy:10)
at grails.plugins.quartz.GrailsJobFactory$GrailsJob.execute(GrailsJobFactory.java:104)
... 2 more
Caused by: org.hibernate.TransactionException: rollback failed
... 4 more
Caused by: org.hibernate.TransactionException: unable to rollback against JDBC connection
... 4 more
Caused by: java.sql.SQLException: Invalid transaction state for requested operation.
... 4 more