首页 > 数据库 >Cannot load driver class: oracle.jdbc.OracleDriver

Cannot load driver class: oracle.jdbc.OracleDriver

时间:2024-01-11 10:15:19浏览次数:35  
标签:load OracleDriver jdbc java jar autoconfigure 2.3 RELEASE

错误信息

Caused by: java.lang.IllegalStateException: Cannot load driver class: oracle.jdbc.OracleDriver
	at org.springframework.util.Assert.state(Assert.java:97) ~[spring-core-5.2.9.RELEASE.jar:5.2.9.RELEASE]
	at org.springframework.boot.autoconfigure.jdbc.DataSourceProperties.determineDriverClassName(DataSourceProperties.java:223) ~[spring-boot-autoconfigure-2.3.4.RELEASE.jar:2.3.4.RELEASE]
	at org.springframework.boot.autoconfigure.jdbc.DataSourceProperties.initializeDataSourceBuilder(DataSourceProperties.java:175) ~[spring-boot-autoconfigure-2.3.4.RELEASE.jar:2.3.4.RELEASE]
	at org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration.createDataSource(DataSourceConfiguration.java:43) ~[spring-boot-autoconfigure-2.3.4.RELEASE.jar:2.3.4.RELEASE]
	at org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Hikari.dataSource(DataSourceConfiguration.java:85) ~[spring-boot-autoconfigure-2.3.4.RELEASE.jar:2.3.4.RELEASE]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_152]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_152]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_152]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_152]
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
	... 73 common frames omitted

错误截图

原因
解决Maven导入oracle驱动包失败
解决方法(2种)
一、手动导入
下载好jar包ojdbc8-19.7.0.0.jar 手动安装

mvn install:install-file -Dfile=C:\Users\Administrator\Downloads\ojdbc8-19.7.0.0.jar -DgroupId=com.oracle -DartifactId=ojdbc8 -Dversion=19.7.0.0 -Dpackaging=jar

-Dile是jar包的路径
二、替换依赖项
原依赖项报错:

<dependency>
    <groupId>com.oracle</groupId>
    <artifactId>ojdbc8</artifactId>
    <version>19.7.0.0</version>
    <scope>provided</scope>
</dependency>

使用其他依赖项替换即可:

<!-- oracle连接驱动 -->
  <dependency>
      <groupId>com.oracle.database.jdbc</groupId>
      <artifactId>ojdbc6</artifactId>
      <version>11.2.0.4</version>
  </dependency>

标签:load,OracleDriver,jdbc,java,jar,autoconfigure,2.3,RELEASE
From: https://www.cnblogs.com/XuBin23/p/17957910

相关文章

  • 对比Spring Boot中的JdbcClient与JdbcTemplate
    本文我们一起看看SpringBoot中JdbcClient和JdbcTemplate之间的差异。以下内容使用的Java和SpringBoot版本为:Java21SpringBoot3.2.1假设我们有一个ICustomerService接口:publicinterfaceICustomerService{List<Customer>getAllCustomer();Optio......
  • absinthe dataloader 简单说明
    dataloader核心是为了解决graphql对于后段服务的频繁调用,absinthe基于graphql的dataloader实现了elixir版本的参考使用代码source=Dataloader.Ecto.new(MyApp.Repo)#setuptheloaderloader=Dataloader.new|>Dataloader.add_source(:db,source)#loadsomethi......
  • SVG 文件的引入方式之一:以 URL 的方式引入 SVG 文件,vue2、vue3+Vite vite-svg-loader
    SVG文件的引入方式之一:以URL的方式引入SVG文件,vue2、vue3+Vitevite-svg-loader〇、前言:本篇将介绍:vue2使用require()引入svg使用vue3+ts+vite使用vite-svg-loader插件引入svg使用并最终实现代码提示一样使用图标文件一、问题描述我有一个长期维护的开源项目:《......
  • JdbcTemplate的基本使用-修改和删除
    JdbcTemplate的基本配置参考我的上一篇文章: JdbcTemplate的基本使用-新增1、修改和删除数据(jdbcTemplate.update)修改和删除跟上面的新增操作一样,只是SQL语句不同而已。UserServiceImpl增加修改和删除方法:packageservice;importdao.UserDao;importentity.User;importorg.sp......
  • 248-html中的DOMContentLoaded事件
    DOMContentLoaded事件在HTML文档解析完成,并且所有的DOM元素已经创建完成,但是在页面的样式表、图像和子框架之类的外部资源加载完成之前触发。这个事件通常用于在页面完全加载之前执行一些JavaScript代码,而无需等待其他资源的加载。DOMContentLoaded事件相较于load事件而言......
  • JdbcTemplate的基本使用-批量新增
    JdbcTemplate的基本配置参考我的上一篇文章:JdbcTemplate的基本使用-新增批量增加可以使用jdbcTemplate.batchUpdate()方法,示例如下:UserServiceImpl增加批量增加方法:packageservice;importdao.UserDao;importentity.User;importorg.springframework.beans.factory.annotat......
  • css3 loading特效
    一个样式类,一个容器,无须额外元素:<!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"><title>LoadingAnimation</title><style>#app{height:100vh;display:flex;alig......
  • JdbcTemplate的基本使用-新增
    一、JdbcTemplate的基本介绍JdbcTemplate是Spring对JDBC的封装,目的是使JDBC更加易于使用,JdbcTemplate是Spring的一部分。JdbcTemplate处理了资源的建立和释放,它帮助我们避免一些常见的错误,比如忘了总要关闭连接。他运行核心的JDBC工作流,如Statement的建立和执行,而我们只需要......
  • JDBC 批量操作 in 的使用
     我们经常会有这种业务需求,根据一个条件集合去查询一张表的数据,比如:select*fromall_elementtwheret.task_idin(List<taskids>);在java语言中,我们需要用到JDBC来和数据库打交道,那么在JDBC中该如何处理这种需求呢?我们可以有如下几种处理方式方案一:写一个函数把参数集合......
  • 小程序更新版本(加载首页onLoad的时候调用)
    /***获取新版本信息*/exportfunctiongetNewVersionUpdateMessage(){console.log('版本更新!')constupdateManager=uni.getUpdateManager();updateManager.onCheckForUpdate(function(res){//请求完新版本信息的回调console.log(res.hasUpdate);......