错误信息
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