Spring boot 应用程序错误日志说尝试在 FanManager 中配置 ONS 失败,并且 oracle.ons.NoServersAvailable

Sai*_*pta 11 java oracle spring spring-boot

我运行一个春天启动应用程序(v2.2.0-RELEASE带)spring-boot-starter-jdbccom.oracle.ojdbc:ojdbc8:19.3.0.0驱动程序。

当我尝试使用查询数据库时,JdbcTemplate我在控制台日志中看到以下错误:

2019-11-15 14:07:51.154 ERROR 23436 --- [main] oracle.simplefan.FanManager: attempt to configure ONS in FanManager failed with oracle.ons.NoServersAvailable: Subscription time out
Run Code Online (Sandbox Code Playgroud)

即使数据库连接成功且查询结果正确,我也不知道为什么我会看到此错误。

有没有办法摆脱这个错误或只是忽略?

Ant*_*łka 23

您可以在启动应用程序时设置系统属性:

-Doracle.jdbc.fanEnabled=false
Run Code Online (Sandbox Code Playgroud)

或者从类路径中删除 simplefan 和 ons jar。使用 Maven,它可能看起来像这样:

<dependency>
  <groupId>com.oracle.database.jdbc</groupId>
  <artifactId>ojdbc10</artifactId>
  <version>${oracle.version}</version>
  <exclusions>
    <exclusion>
      <groupId>com.oracle.database.ha</groupId>
      <artifactId>simplefan</artifactId>
    </exclusion>
    <exclusion>
      <groupId>com.oracle.database.ha</groupId>
      <artifactId>ons</artifactId>
    </exclusion>
  </exclusions>
</dependency>
Run Code Online (Sandbox Code Playgroud)

Oracle JDBC 开发人员指南“用于 FAN 事件支持的 Oracle JDBC 驱动程序的安装和配置”的第 29.3 节中的更多详细信息。