无法创建池-Spring启动与Oracle DB的初始连接

无法创建池-Spring启动与Oracle DB的初始连接,oracle,spring-boot,Oracle,Spring Boot,我正在尝试使用Oracle DB运行Springboot应用程序。执行后 java-jarspringbootshibernate-0.0.1-SNAPSHOT.jar 低于错误无法创建池的初始连接。 2020-09-26 13:35:24 INFO com.programmer.gate.Application - Starting Application v0.0.1-SNAPSHOT on lax13 with PID 1356 (/home/cavisson/spring-bo

我正在尝试使用Oracle DB运行Springboot应用程序。执行后

java-jarspringbootshibernate-0.0.1-SNAPSHOT.jar

低于错误无法创建池的初始连接。

    2020-09-26 13:35:24 INFO  com.programmer.gate.Application - Starting Application v0.0.1-SNAPSHOT on lax13 with PID 1356 (/home/cavisson/spring-boot-jpa-hibernate-master/target/SpringBootHibernate-0.0.1-SNAPSHOT.jar started by root in /home/cavisson/spring-boot-jpa-hibernate-master/target)
2020-09-26 13:35:24 INFO  com.programmer.gate.Application - No active profile set, falling back to default profiles: default
2020-09-26 13:35:24 INFO  o.s.c.a.AnnotationConfigApplicationContext - Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@443b7951: startup date [Sat Sep 26 13:35:24 IST 2020]; root of context hierarchy
2020-09-26 13:35:25 WARN  o.a.tomcat.jdbc.pool.ConnectionPool - initialSize is larger than maxActive, setting initialSize to: 1
2020-09-26 13:35:25 WARN  o.a.tomcat.jdbc.pool.ConnectionPool - minIdle is larger than maxActive, setting minIdle to: 1
2020-09-26 13:35:25 WARN  o.a.tomcat.jdbc.pool.ConnectionPool - maxIdle is larger than maxActive, setting maxIdle to: 1
2020-09-26 13:35:25 ERROR o.a.tomcat.jdbc.pool.ConnectionPool - Unable to create initial connections of pool.
java.sql.SQLException: Unable to load class: oracle.jdbc.OracleDriver from ClassLoader:org.springframework.boot.loader.LaunchedURLClassLoader@19469ea2;ClassLoader:org.springframework.boot.loader.LaunchedURLClassLoader@19469ea2
有人能告诉我这个错误背后的原因吗?我已经交叉检查了oracle连接是否处于良好状态

这是我的应用程序属性-

# create n drop tables, loads import.sql
spring.jpa.hibernate.ddl-auto=create-drop

# Oracle settings
spring.datasource.url=jdbc:oracle:thin:@HostIP:1521:orcl
spring.datasource.username=SYS
spring.datasource.password=ABC@123
spring.datasource.driver.class=oracle.jdbc.driver.OracleDriver

# logging
logging.pattern.console=%d{yyyy-MM-dd HH:mm:ss} %-5level %logger{36} - %msg%n
logging.level.org.hibernate.SQL=debug

spring.datasource.dbcp2.max-total=1
spring.datasource.tomcat.max-active=1
POM.xml中的条目

<dependency>
 <groupId>com.oracle</groupId>
 <artifactId>ojdbc7</artifactId>
 <version>12.1.0</version>
 </dependency>

com.oracle
ojdbc7
12.1.0

从您共享的日志来看,您的pom.xml中似乎缺少
Oracle驱动程序

转到您的pom.xml, 滚动至
部分,然后 添加以下依赖项

<!-- https://mvnrepository.com/artifact/com.oracle.jdbc/ojdbc8 -->
<dependency>
    <groupId>com.oracle.jdbc</groupId>
    <artifactId>ojdbc8</artifactId>
    <version>12.2.0.1</version>
</dependency>

com.oracle.jdbc
ojdbc8
12.2.0.1
然后执行maven clean安装以创建一个新的jar,并确保您不只是复制粘贴此处提供的oracle依赖项,而是检查它是否与您的oracle版本对应


请编辑您的问题并添加您的pom.xml的详细信息

您好,共享您在项目中使用的配置将非常有帮助。顺便说一下,这里已经有您的问题的几乎完全相同的副本。唯一的区别是它使用的是MySql,可能您也有同样的问题,看看:这回答了你的问题吗?我正在使用
com.oracle ojdbc6 11.2.0.3 system${project.basedir}/src/main/webapp/WEB-INF/lib/oracle-ojdbc6-11.2.0.3.jar
删除
系统路径
范围
,然后tryI做了一些更改,比如
被缓存在本地存储库中,明白了,您需要在maven项目中更新索引,您正在使用intellij吗?当jar位于m2上而不在项目库中时,我遇到了这个问题。您所要做的就是更新maven索引并重新安装项目,这样它就会将jar文件带到您的库中folder@SaurabhGupta很乐意帮忙