Reputation: 13
I am trying to run Springboot application with Oracle DB. After executing
java -jar SpringBootHibernate-0.0.1-SNAPSHOT.jar
Getting below error of Unable to create initial connections of pool.
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
Can someone help me the reason behind this error | I have crossed check that oracle connection is placed fine.
Here is my application properties -
# 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
Entry in POM.xml
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0</version>
</dependency>
Upvotes: 1
Views: 1622
Reputation: 1476
From the logs you shared it seems like you are missing Oracle Driver
in your pom.xml
Go to your pom.xml,
scroll to the <dependencies>
section and
add the following dependency
<!-- https://mvnrepository.com/artifact/com.oracle.jdbc/ojdbc8 -->
<dependency>
<groupId>com.oracle.jdbc</groupId>
<artifactId>ojdbc8</artifactId>
<version>12.2.0.1</version>
</dependency>
Then do a maven clean install to create a new jar and also make sure that you don't just copy paste the oracle dependency provided here but rather check if it is the one corresponding to your oracle version.
Do edit your question and add details of your pom.xml as well
Upvotes: 3