SpringBoot error: Registered driver with driverClassName=oracle.jdbc.driver.OracleDriver was not found, trying direct instantiation

SpringBoot error: Registered driver with driverClassName=oracle.jdbc.driver.OracleDriver was not found, trying direct instantiation



I am learning SpringBoot and I just tried running my project which used to run successfully, but now this error pops up


enter cod2018-08-25 11:30:21 WARN c.z.hikari.util.DriverDataSource - Registered driver with driverClassName=oracle.jdbc.driver.OracleDriver was not found, trying direct instantiation.
2018-08-25 11:30:24 ERROR com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Exception during pool initialization.
java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connectione here



after this couple of exceptions are thrown like..


Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method) ~[na:1.8.0_144]

Caused by: java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:673) ~[ojdbc7-12.1.0.2.jar:12.1.0.1.0]



application.properties:


#server
server.port=7003

#database
spring.jpa.database-platform=org.hibernate.dialect.Oracle10gDialect
spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver
spring.datasource.url=jdbc:oracle:thin:@localhost:1521:Xe
spring.datasource.username=XXXXXX
spring.datasource.password=XXXXXX
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults=false

#logging
logging.pattern.console=%dyyyy-MM-dd HH:mm:ss %-5level %logger36 - %msg%n
logging.level.org.hibernate.SQL=INFO
logging.level.org.hibernate.type.descriptor.sql=trace
logging.level.=INFO

#eureka-guidelines
eureka.client.register-with-eureka=true
eureka.client.serviceUrl.defaultZone=http://localhost:7005/eureka
spring.application.name=SupplyManagement_14_SpringBoot



Pom.xml


<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.myapp.supplyManagement</groupId>
<artifactId>SupplyManagement_14_SpringBoot</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>SupplyManagement_14_SpringBoot</name>
<description>Demo project for Spring Boot</description>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<spring-cloud.version>Finchley.SR1</spring-cloud.version>
</properties>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.2</version>
</dependency>
</dependencies>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>$spring-cloud.version</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>


</project>



I tried some debugging, like
1. manually checking oracle.jdbc.driver.OracleDriver is there or not.
2. using other ojdbc's like 6.
3. maven updates.



But nothing seems to work. Any help is appreciated.



UPDATE



I have no Idea why, But I restarted my System and now it works fine.




2 Answers
2



It clearly indicates driver is missing, please check maven local repository, look for jdbc driver jar file in XX:userXXXm2XX



From oracle web site to connect with Oracle 12 using JDK 8 you can follow this..


<groupid>com.oracle.jdbc</groupid>
<artifactid>ojdbc8</artifactid>
<version>12.2.0.1</version>





I have checked it the ojdbc jar is there. Also my normal jdbc stuff is wotking with the help of this jar.
– Shlok Srivastava
Aug 25 at 6:48



I think this dependency to get the Oracle JDBC driver was not found on Maven repository.



So, better review POM for this dependency. FYI, the oracle doesn't post the latest JDBC driver in Maven repository. If you wish to get the latest JDBC driver from the Oracle database installation folder ($ORACLE_INSTALLATION/jdbc) or download it from Oracle Technology Network website. You may refer to this link if you are using 12c version:



https://www.oracle.com/technetwork/database/features/jdbc/jdbc-ucp-122-3110062.html



Then, you need to create new folder to locate your Oracle JDBC driver inside your project and change the dependency for Oracle JDBC by pointing it into the folder you just create.





I knew maven wont keep the jar file for me. Thats why i did it manually and placed the jar file at the local maven repo, but as of now it doesnt work.
– Shlok Srivastava
Aug 25 at 7:02





Please try to change it by following this link: roufid.com/3-ways-to-add-local-jar-to-maven-project
– Gunardy Sutanto
Aug 25 at 7:11






Gunardy Sutanto I used the first method stated in your link. I have directly added it to the ojdbc7 folder so the path is not needed.
– Shlok Srivastava
Aug 25 at 7:32






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

How do I collapse sections of code in Visual Studio Code for Windows?

ャフサォクコ ケウ,コ,ワ メ,ロスョノ゙,クネ,フムカヤヲニ,エコ゚ツ ウイオン゙ケワサネォキモュキォウイノンコチ゚メヌナイゥフュ,カヒウネェ ネ,ホノケ,ムュキ ッボーミュハ,チ ツス ィ メウイマヤ,゙ウチ ヅ ロ,ォジヌェ ャヌット ェ,マャ,チナエヒネソキツテ トホヲヲミーァ