Issue with ojdbc jar in Maven

Charan  picture Charan · Nov 2, 2018 · Viewed 13.4k times · Source

I've developed a project in Java 8 and I've installed the ojdbc jar in maven when I developed the project using java 8. Now I'm converting the project into java 7. While doing so, I'm facing issue with ojdbc.jar dependency in pom.xml. Its showing:

Missing artifact com.oracle:ojdbc7:jar:12.1.0

at oracle dependency tag. When I try to run the mvn install for ojdbc jar, that also throws an error.

[ERROR] Failed to execute goal on project SlotBookingAvailability: Could not resolve dependencies for project org.logicInfo.oms:SlotBookingAvailability:war:0.0. 1-SNAPSHOT: Failure to find com.oracle:ojdbc7:jar:12.1.0 in https://repo.maven.a pache.org/maven2 was cached in the local repository, resolution will not be reat tempted until the update interval of central has elapsed or updates are forced.

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>org.logicInfo.oms</groupId>
<artifactId>SlotBookingAvailability</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>

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

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


<properties>
    <start-class>org.logicInfo.oms.SlotBookingAvailability.SlotBookingAvailabilityApplication</start-class>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.7</java.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>com.oracle</groupId>
        <artifactId>ojdbc7</artifactId>
        <version>12.1.0</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-jdbc</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.json/json -->
    <dependency>
        <groupId>org.json</groupId>
        <artifactId>json</artifactId>
        <version>20180813</version>
    </dependency>
</dependencies>

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

</project>

Can someone help me out of this?

Answer

Karol Dowbecki picture Karol Dowbecki · Nov 2, 2018

Oracle JDBC drviers (ojdbc6.jar, ojdbc7.jar, ojdbc8.jar) are not published into Maven Central repository due to Oracle license. If it worked before you must have installed it locally (e.g. by running mvn install:install-file) or used a repository other than Maven Central which had it.

You need to download the ojdbc7 from Oracle website manually and agree to OTN License Agreement. Ideally you would download the ojdbc7 JAR to match your Oracle Database server version (SELECT * FROM v$version).