Oracle 数据源连接报 “PoolInitializationException: Failed to initialize pool: Timer already cancelled“

问题概要

Springboot项目动态注册数据源,当注册数据源为Oracle的时候,初始化HikariDataSource时,报PoolInitializationException: Failed to initialize pool: Timer already cancelled....。项目使用jaeger 用来链路追踪。

项目配置

springboot version:2.3.11
opentracing-spring-jaeger-cloud-starter version: 3.3.1
ojdbc8 version:19.3.0.0

原因分析

由于项目使用jaeger作为链路追踪,且采用的版本为3.3.1。在该版本中,使用的contrib-java-jdbc版本为0.2.8
在该jaeger版本中,使用的interceptor mode,需要TracingDriver 第一个注册驱动,以至于该模式可以获取所有jdbc url,在委托给真实的驱动器。但是DriverManager 并没有提供注册顺序,所以该版本便将所有的驱动器先取消注册,然后注册TracingDriver ,在然后将之前取消注册的驱动器,在注册上去。但是Oracle的驱动器并不支持取消注册后在注册。所以会报该错误。
该问题已在contrib-java-jdbc:0.2.11版本中修复。

Because interceptor mode need TracingDriver be the first driver, so it can accepts any jdbc url then delegate to the real driver, It's a pity that DriverManager doesn't provide a mechanism to control drivers order.

解决方案

升级contrib-java-jdbc版本,将其修改为0.2.11

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>io.opentracing.contrib</groupId>
                <artifactId>opentracing-jdbc</artifactId>
                <version>0.2.11</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

参考资料

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值