Grails DB Outage导致应用程序崩溃

时间:2014-02-05 17:57:05

标签: hibernate tomcat grails gorm grails-2.0

我们的应用程序在Grails上运行,我们有MS SQL数据库。我们的客户有问题。问题是他们的数据库服务器由于某种原因而突然停止运行。它只是暂时的,通常会在几分钟左右回来。每当它关闭并且用户尝试访问应用程序时,他们都会看到此错误:

Caused by: org.hibernate.TransactionException: JDBC begin failed:
        at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:92)
        at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1473)
        at org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:555)
        ... 84 more
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The connection is closed.
        at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:190)
        at com.microsoft.sqlserver.jdbc.SQLServerConnection.checkClosed(SQLServerConnection.java:388)
        at com.microsoft.sqlserver.jdbc.SQLServerConnection.getAutoCommit(SQLServerConnection.java:

我用Google搜索并找到了几个链接:

MySQL Connection Timeout Issue - Grails Application on Tomcat using Hibernate and ORM

http://andrzejgrzesik.info/2011/12/18/grails-automatically-reconnect-to-mysql-datasource/

但在上述两种情况下,似乎应用程序通常会在用户尝试几次后出现在UI上。但是,在我的情况下,UI永远不会出现,尽管将数据库带回来,我们仍然会看到相同的错误。只有在我们重新启动grails实例(即tomcat)之后,我们才能看到应用程序。

Currenlty,我们的DataSourceConfig非常明星前进:

dataSource {
            dialect = org.hibernate.dialect.SQLServerDialect
            driverClassName = 'com.microsoft.sqlserver.jdbc.SQLServerDriver'
            username = 'user'
            password = 'P@SSWorD'
            url = 'jdbc:sqlserver://hostName;DatabaseName=dbName;instanceName=instanceName'
            dbCreate = 'update' // Deliberately kept in update mode due to some reasons. Please advise if it has to be changed as well.
}

感谢您的帮助,因为这个问题现在就在我们的脑海中。

0 个答案:

没有答案