Grails maxRows/queryTimeout警告

Grails maxRows/queryTimeout警告,grails,Grails,我似乎在Grails2.2.4应用程序中随机得到下面的警告。它看起来没有引起任何问题,但它仍然令人担忧 我试图通过修改我的datasource.groovy文件中的数据源属性来防止此警告: dataSource { pooled = true properties { maxWait = 10000 // 10 seconds minEvictableIdleTimeMillis = 1000 * 60 * 30 // 30 minutes

我似乎在Grails2.2.4应用程序中随机得到下面的警告。它看起来没有引起任何问题,但它仍然令人担忧

我试图通过修改我的
datasource.groovy
文件中的数据源属性来防止此警告:

dataSource {
    pooled = true
    properties {
        maxWait = 10000 // 10 seconds
        minEvictableIdleTimeMillis = 1000 * 60 * 30 // 30 minutes
        numTestsPerEvictionRun = 3
        testOnBorrow = true
        testOnReturn = false
        testWhileIdle = false
        timeBetweenEvictionRunsMillis = 1000 * 60 * 30 // 30 minutes
        validationQuery = "SELECT 1"
    }
}
def init = { servletContext ->
    def ctx = Holders.getApplicationContext()
    def dataSource = ctx.dataSourceUnproxied

    println "configuring database connection pool"

    dataSource.setMinEvictableIdleTimeMillis(1000 * 60 * 30)
    dataSource.setTimeBetweenEvictionRunsMillis(1000 * 60 * 30)
    dataSource.setNumTestsPerEvictionRun(3)
    dataSource.setTestOnBorrow(true)
    dataSource.setTestWhileIdle(false)
    dataSource.setTestOnReturn(false)
    dataSource.setValidationQuery("SELECT 1")
}
当这不起作用时,我尝试在我的
BootStrap.groovy
文件中设置属性:

dataSource {
    pooled = true
    properties {
        maxWait = 10000 // 10 seconds
        minEvictableIdleTimeMillis = 1000 * 60 * 30 // 30 minutes
        numTestsPerEvictionRun = 3
        testOnBorrow = true
        testOnReturn = false
        testWhileIdle = false
        timeBetweenEvictionRunsMillis = 1000 * 60 * 30 // 30 minutes
        validationQuery = "SELECT 1"
    }
}
def init = { servletContext ->
    def ctx = Holders.getApplicationContext()
    def dataSource = ctx.dataSourceUnproxied

    println "configuring database connection pool"

    dataSource.setMinEvictableIdleTimeMillis(1000 * 60 * 30)
    dataSource.setTimeBetweenEvictionRunsMillis(1000 * 60 * 30)
    dataSource.setNumTestsPerEvictionRun(3)
    dataSource.setTestOnBorrow(true)
    dataSource.setTestWhileIdle(false)
    dataSource.setTestOnReturn(false)
    dataSource.setValidationQuery("SELECT 1")
}
这两种尝试都不能阻止警告。post的作者说他已经成功地直接在tomcat配置中设置了属性,但是我需要一个更通用的解决方案,它可以在命令行和其他服务器中工作

2013-09-25 15:07:51,027 [http-bio-8080-exec-9] WARN  jdbc.AbstractBatcher  - exception clearing maxRows/queryTimeout
java.sql.SQLException: org.apache.commons.dbcp.DelegatingPreparedStatement with address: "com.mysql.jdbc.JDBC4PreparedStatement@13ed0db0: EXCEPTION: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after statement closed." is closed.
    at org.apache.commons.dbcp.DelegatingStatement.checkOpen(DelegatingStatement.java:137)
    at org.apache.commons.dbcp.DelegatingStatement.getMaxRows(DelegatingStatement.java:237)
    at ace_2.DefsUploadController.upload(DefsUploadController.groovy:16)
    at grails.plugin.cache.web.filter.PageFragmentCachingFilter.doFilter(PageFragmentCachingFilter.java:195)
    at grails.plugin.cache.web.filter.AbstractFilter.doFilter(AbstractFilter.java:63)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:724)

在与MySQL数据库的连接超时后,我也会看到这个异常。我使用中的建议作为指导更新了数据源配置,并且我还没有看到关闭连接的任何异常

以下是我当前的设置:

    properties {
        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 = false
        jdbcInterceptors = "ConnectionState;StatementCache(max=200)"
        defaultTransactionIsolation = java.sql.Connection.TRANSACTION_READ_COMMITTED
    }

在与MySQL数据库的连接超时后,我也会看到这个异常。我使用中的建议作为指导更新了数据源配置,并且我还没有看到关闭连接的任何异常

以下是我当前的设置:

    properties {
        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 = false
        jdbcInterceptors = "ConnectionState;StatementCache(max=200)"
        defaultTransactionIsolation = java.sql.Connection.TRANSACTION_READ_COMMITTED
    }