gpt4 book ai didi

java.sql.SQLRecoverableException :Closed Connection 错误

转载 作者:塔克拉玛干 更新时间:2023-11-01 22:30:54 24 4
gpt4 key购买 nike

我在 Oracle 11 上使用 jboss7.0.2 final。目前我面临一个随机发生的问题。但是在重负载期间,此错误跟踪不断增长。尝试了很多方法都没有成功。

我的数据源配置:

<?xml version="1.0" encoding="UTF-8"?>
<datasource jndi-name="sportPool" pool-name="sportPool" enabled="true" jta="true" use-java-context="true" use-ccm="true">
<connection-url>jdbc:oracle:thin:@10.11.252.200:1521:sportsdb</connection-url>
<driver>oracleDriver</driver>
<pool>
<min-pool-size>1</min-pool-size>
<max-pool-size>75</max-pool-size>
<prefill>false</prefill>
<use-strict-min>false</use-strict-min>
<flush-strategy>FailingConnectionOnly</flush-strategy>
</pool>
<security>
<user-name>mportal</user-name>
<password>mobile</password>
</security>
<timeout>
<idle-timeout-minutes>60000</idle-timeout-minutes>
</timeout>
</datasource>

堆栈跟踪:

nested exception is java.sql.SQLRecoverableException: Closed Connection
at org.springframework.jdbc.support.SQLExceptionSubclassTranslator.translate(SQLExceptionSubclassTranslator.java:82)
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.translate(SQLErrorCodeSQLExceptionTranslator.java:237)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:604)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:638)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:667)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:683)

... 50 more
Caused by: java.sql.SQLRecoverableException: Closed Connection
at oracle.jdbc.driver.OracleStatement.ensureOpen(OracleStatement.java:4051)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3563)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3628)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1493)
at org.jboss.jca.adapters.jdbc.CachedPreparedStatement.executeQuery(CachedPreparedStatement.java:111)
at org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:462)
at org.springframework.jdbc.core.JdbcTemplate$1.doInPreparedStatement(JdbcTemplate.java:645)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:588)
... 56 more

最佳答案

  1. 查看您的数据库设置 - 数据库中设置的超时时间可能比数据源部署描述符中设置的超时时间短,并且数据库关闭了连接。

  2. 检查您的网络 - 可能是您的防火墙/路由设置有问题,并且连接在路由中间某处关闭/断开。

  3. 看看这个链接JBoss 7 Datasource Configuration .有一种配置数据源描述符的方法,强制 JBoss 在从池中 check out 连接时检查连接。使用 valid-connection-checker(更快)或 check-valid-connection-sql(更慢)设置并设置

    <valid-connection-checker>
    org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker
    </valid-connection-checker>

    <check-valid-connection-sql>
    SELECT 1 FROM DUAL
    </check-valid-connection-sql>

关于java.sql.SQLRecoverableException :Closed Connection 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11501500/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com