2

i'am using spring boot with oracle V11.2.0.4.0 database to develop a microservice, But my pringBootApplication failed to run due to this following error:

2020-02-18 15:24:12.943  INFO 16476 --- [           main] com.zaxxer.hikari.HikariDataSource       : 
HikariPool-1 - Starting...
2020-02-18 15:24:13.041  INFO 16476 --- [           main] com.zaxxer.hikari.pool.PoolBase          : 
HikariPool-1 - Driver does not support get/set network timeout for connections. 
(oracle.jdbc.driver.T4CConnection.getNetworkTimeout()I)
2020-02-18 15:24:13.045  INFO 16476 --- [           main] com.zaxxer.hikari.HikariDataSource       : 
HikariPool-1 - Start completed.
2020-02-18 15:24:13.058  INFO 16476 --- [           main] org.hibernate.dialect.Dialect            : 
HHH000400: Using dialect: org.hibernate.dialect.Oracle10gDialect
2020-02-18 15:24:13.205 **ERROR** 16476 --- [           main] o.h.e.j.e.internal.JdbcEnvironmentImpl   : 
Could not fetch the SequenceInformation from the database
2020-02-18 15:24:13.662  WARN 16476 --- [           main] o.h.engine.jdbc.spi.SqlExceptionHelper   : 
SQL Error: 17026, SQLState: 99999
2020-02-18 15:24:13.662 ERROR 16476 --- [           main] o.h.engine.jdbc.spi.SqlExceptionHelper   : 
Numeric Overflow
2020-02-18 15:24:13.668  WARN 16476 --- [           main] ConfigServletWebServerApplicationContext : 
Exception encountered during context initialization - cancelling refresh attempt: 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 
'entityManagerFactory' defined in class path resource 
[org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init 
method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] 
Unable to build Hibernate SessionFactory; nested exception is 
org.hibernate.exception.GenericJDBCException: Unable to build DatabaseInformation
2020-02-18 15:24:13.668  INFO 16476 --- [           main] com.zaxxer.hikari.HikariDataSource       : 

Error starting ApplicationContext. To display the conditions report re-run your application with 
'debug' enabled.
2020-02-18 15:24:13.702 ERROR 16476 --- [           main] o.s.boot.SpringApplication               : 
Application run failed

java.sql.SQLException: Numeric Overflow
at oracle.jdbc.driver.NumberCommonAccessor.throwOverflow(NumberCommonAccessor.java:4170) ~[ojdbc6- 
11.2.0.4.0.jar:12.1.0.1.0]

Here is my 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 https://maven.apache.org/xsd/maven- 
     4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.2.4.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>ibbl.lu</groupId>
<artifactId>microservice_lims</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>microservice_lims</name>
<description>Demo project for Spring Boot</description>

<properties>
    <java.version>1.8</java.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-data-rest</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <!-- ojdbc6.jar example -->
    <dependency>
        <groupId>com.oracle</groupId>
        <artifactId>ojdbc6</artifactId>
        <version>11.2.0.4.0</version>
    </dependency>

    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <optional>true</optional>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>org.junit.vintage</groupId>
                <artifactId>junit-vintage-engine</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
</dependencies>

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

here is my application.properties

spring.jpa.hibernate.ddl-auto=update
spring.datasource.url= jdbc:oracle:thin:@Oracle-dev.xxx.xx.xx:1521:LBVT
spring.datasource.username=xxxx
spring.datasource.password=xxx!
spring.datasource.driver-class-name=oracle.jdbc.OracleDriver
spring.jpa.show-sql=true

Someone have an idea about this issue ? I already download the ojdbc6.jar and use maven command to install the driver any clue will be helpful

Syllaba Abou Ndiaye
  • 213
  • 1
  • 7
  • 21
  • 1
    Are you using any sequences ? If yes, take a look at https://stackoverflow.com/questions/58570032/hibernate-could-not-fetch-the-sequenceinformation-from-the-database – GabLeg Feb 18 '20 at 16:10

1 Answers1

3

The problem is due to MAX_VALUE to large in All_sequence, That's why i had this error

java.sql.SQLException: Numeric Overflow

I fixed this issue as follows: I created a Custom class which extends Oracle10gDialect and redefined MIN_VALUE, MAX_VALUE in ALL_SEQUENCES, Here is my class

package ibbl.lu.microservice_lims.config;

import org.hibernate.dialect.Oracle10gDialect;

public class CustomOracleDialect extends Oracle10gDialect {

    @Override
    public String getQuerySequencesString() {
        return "SELECT SEQUENCE_OWNER, SEQUENCE_NAME, 
                greatest(MIN_VALUE,-9223372036854775807) MIN_VALUE,\n" +
                "Least(MAX_VALUE, 9223372036854775808) MAX_VALUE, 
                INCREMENT_BY,CYCLE_FLAG, ORDER_FLAG, CACHE_SIZE,\n" +
                "Least(greatest(LAST_NUMBER, -9223372036854775807), 
                9223372036854775808) LAST_NUMBER from ALL_SEQUENCES";
    }
}

In the application.properties file referred to a dialect implementation

spring.jpa.properties.hibernate.dialect=ibbl.lu.microservice_lims.config.CustomOracleDialect
Syllaba Abou Ndiaye
  • 213
  • 1
  • 7
  • 21