【问题标题】:java.lang.AbstractMethodError: oracle.jdbc.driver.T4CConnection.isValid(I)Z Spring Boot with Intellijjava.lang.AbstractMethodError: oracle.jdbc.driver.T4CConnection.isValid(I)Z Spring Boot with Intellij
【发布时间】:2020-03-18 11:56:19
【问题描述】:

我正在尝试使用 IntelliJ 运行我的 Spring Boot 应用程序,并且我正在使用 Oracle JDBC 我总是遇到这个错误:

java.lang.AbstractMethodError: oracle.jdbc.driver.T4CConnection.isValid(I)Z

我认为这是一个依赖问题,我删除了所有 .m2 存储库并重新导入了项目,但我得到了同样的错误

这是我的 application.properties :

server:
  port: 9000
spring:
  profiles: dev
  datasource:
    url: jdbc:oracle:thin:@localhost:1521:xe
    username: me
    password: me
    driver-class-name: oracle.jdbc.OracleDriver
  jpa:
    database-platform: org.hibernate.dialect.Oracle10gDialect
    hibernate:
      ddl-auto: update
    show-sql: true
  autoconfigure:
    exclude: org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration
  data:
    rest:
      base-path: /api
  liquibase:
    enabled: false
    change-log: classpath:db/changelog/changelog-master.yaml

这是我 pom.xml 中的 oracle 依赖项:

<dependency>
        <groupId>com.oracle.ojdbc</groupId>
        <artifactId>ojdbc8</artifactId>
        <scope>runtime</scope>
    </dependency>

【问题讨论】:

  • 将validationQuery="SELECT 1" 添加到您的数据资源
  • 我添加了它,但我仍然得到同样的错误

标签: spring-boot maven intellij-idea


【解决方案1】:

您需要指定要使用的 JDBC 版本。有关详细信息,请参阅blog

<dependency>
  <groupId>com.oracle.database.jdbc</groupId>
  <artifactId>ojdbc8</artifactId>
  <version> 19.3.0.0 </version>
  <scope>runtime</scope>
</dependency>

【讨论】:

    猜你喜欢
    • 2021-12-14
    • 2015-12-08
    • 2015-12-23
    • 2017-10-10
    • 1970-01-01
    • 2016-10-16
    • 2014-08-13
    • 1970-01-01
    • 2015-11-15
    相关资源
    最近更新 更多