在自由运行应用程序时运行负载测试,并通过JNDI从自由获取数据源时,测试在大约一分钟后失败,但以下情况除外:
由以下原因引起:org.springframework.jdbc.CannotGetJdbcConnectionException:无法获取JDBC连接。嵌套的异常是java.sql.SQLTransientConnectionException:J2CA0045E:为资源jdbc / MY_JNDI_NAME调用方法createOrWaitForConnection时,连接不可用。超时等待30,000毫秒,剩余29个等待请求和10个当前使用的连接。
直接在spring-application中配置数据源(并因此使用HikariCP作为连接池)时,同一测试成功运行了10分钟。
已尝试从应用程序中排除hikaricp依赖项,以确保hikari不会以某种方式涉及自身。
edit1: 进行相同的呼叫时似乎有一些不同的行为。从春季开始(执行commit和afterCommit):
2019-05-15 13:03:09.855 TRACE 93902 --- [nio-8070-exec-3] o.s.j.d.DataSourceTransactionManager : Triggering beforeCommit synchronization
2019-05-15 13:03:09.855 TRACE 93902 --- [nio-8070-exec-3] o.s.j.d.DataSourceTransactionManager : Triggering beforeCompletion synchronization
2019-05-15 13:03:09.855 DEBUG 93902 --- [nio-8070-exec-3] o.s.j.d.DataSourceTransactionManager : Initiating transaction commit
2019-05-15 13:03:09.855 DEBUG 93902 --- [nio-8070-exec-3] o.s.j.d.DataSourceTransactionManager : Committing JDBC transaction on Connection [HikariProxyConnection@942192123 wrapping oracle.jdbc.driver.T4CConnection@38af1bf6]
2019-05-15 13:03:09.863 TRACE 93902 --- [nio-8070-exec-3] o.s.j.d.DataSourceTransactionManager : Triggering afterCommit synchronization
2019-05-15 13:03:09.863 TRACE 93902 --- [nio-8070-exec-3] .s.t.s.TransactionSynchronizationManager : Clearing transaction synchronization
2019-05-15 13:03:09.863 TRACE 93902 --- [nio-8070-exec-3] o.s.j.d.DataSourceTransactionManager : Triggering afterCompletion synchronization
2019-05-15 13:03:09.863 TRACE 93902 --- [nio-8070-exec-3] .s.t.s.TransactionSynchronizationManager : Removed value [org.springframework.jdbc.datasource.ConnectionHolder@550224fb] for key [HikariDataSource (DS-RGVALIDATION)] from thread [http-nio-8070-exec-3]
这是来自自由的同样呼吁:
[5/16/19 9:31:37:556 CEST] 0000002a id=00000000 ework.transaction.support.AbstractPlatformTransactionManager 3 triggerBeforeCommit Triggering beforeCommit synchronization
[5/16/19 9:31:37:557 CEST] 0000002a id=00000000 ework.transaction.support.AbstractPlatformTransactionManager 3 triggerBeforeCompletion Triggering beforeCompletion synchronization
[5/16/19 9:31:37:558 CEST] 0000002a id=00000000 mework.transaction.support.TransactionSynchronizationManager 3 doUnbindResource Removed value [org.springframework.jdbc.datasource.ConnectionHolder@ec5e4040] for key [com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource@5596007b] from thread [Default Executor-thread-2]
两个调用均以TransactionSynchronizationManager删除数据源上键入的值结束