【发布时间】:2016-07-18 01:47:34
【问题描述】:
我在我的项目中使用 grails 2.3.11 和 Oracle DB。
我的数据库有问题。 例外:
ERROR (org.hibernate.util.JDBCExceptionReporter) - [99824F7C5386E5A40F94939FF36481FE | admin] - PooledConnection has already been closed.
运行以下代码时出现错误:
@NotTransactional
@Cacheable
def findSmth(String Id) {
//Some logic here
Employee.findWhere(company: company, employee: employee)
}
这段代码反复执行,在某次迭代中出现错误。
注意:我使用多个数据源。错误发生在具有以下数据源的数据库中:
dataSource_employee_ro {
dbCreate = 'validate'
dialect = org.hibernate.dialect.Oracle10gDialect
driverClassName = "oracle.jdbc.driver.OracleDriver"
url = 'jdbc:oracle:thin:@(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = ****)(PORT = 2001))(FAILOVER = true)(LOAD_BALANCE = on)(CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = ****)(FAILOVER_MODE = (TYPE=select) (METHOD=basic) (RETRIES=10) (DELAY=3))))'
username = '****'
password = '******'
readOnly = true
properties {
maxActive = 10
maxIdle = 5
minIdle = 1
initialSize = 8
testOnBorrow = true
testWhileIdle = true
testOnReturn = false
validationQuery = "SELECT 1 FROM dual"
}
domainSchema = '*****'
}
即使我设置了“isPooled = false”,也会出现异常(看起来像“连接已关闭”)。
我不知道如何摆脱这个错误。 谁能帮我?谢谢。
【问题讨论】:
-
我也有同样的问题,一个查找查询的方法失败了,PooledConnection has already been closed 错误,没有任何明显的原因。
标签: java oracle tomcat grails web