Process finished with exit code 0 Spring Boot Application - spring-boot

i am creating the simple spring boot project while i running the project IntelliJ Process finished.Process finished with exit code 0
i don't know what will be the reason.what tried so far i attached below
<?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.7.5</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>Crudnew</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Crudnew</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-web</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.27</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
TestController
#RestController
#CrossOrigin
#RequestMapping("api/v1/test")
public class TestController {
#PostMapping
public void getMyApp()
{
String myApp = "This my First Application";
System.out.println(myApp);
}
}
While Running the Project i got this line then exit
2022-11-15 16:46:22.330 INFO 29988 --- [ main] com.example.Crudnew.CrudnewApplication : Starting CrudnewApplication using Java 1.8.0_202 on LAPTOP-RGN0DEFS with PID 29988 (F:\Crudnew\Crudnew\target\classes started by HP in F:\Crudnew\Crudnew)
2022-11-15 16:46:22.333 INFO 29988 --- [ main] com.example.Crudnew.CrudnewApplication : No active profile set, falling back to 1 default profile: "default"
2022-11-15 16:46:22.721 INFO 29988 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2022-11-15 16:46:22.728 INFO 29988 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 2 ms. Found 0 JPA repository interfaces.
2022-11-15 16:46:22.997 INFO 29988 --- [ main] com.example.Crudnew.CrudnewApplication : Started CrudnewApplication in 1.063 seconds (JVM running for 1.874)
Process finished with exit code 0

Can you put the starter-web dependency above the data-jpa one and try again?
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

Related

Running SQL scripts on startup with spring boot and h2 memory database

I have a spring-boot application where i'm running a h2 memory database, however I can't seem to run SQL scripts when starting the app. I want to run a script to create a couple of tables.
This script works fine when I run it manually, but I want to run it automatically on startup.
I have understood that the script should be ran automatically when put in the src/main/resources directory, which is also the classpath.
I found this Stackoverflow question which seems to contain all sorts of different answers, however none of them seem to work for me.
This 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.6.3</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>...</groupId>
<artifactId>...</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>...</name>
<description>...</description>
<properties>
<java.version>17</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<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-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.3.6</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.193</version>
</dependency>
<!-- Switch back from Spring Boot 2.x standard HikariCP to Tomcat JDBC,
configured later in Heroku (see https://stackoverflow.com/a/49970142/4964553) -->
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</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>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>app/**</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>com.heroku.sdk</groupId>
<artifactId>heroku-maven-plugin</artifactId>
<version>2.0.8</version>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
This is how my application.properties looks like :
spring.h2.console.enabled=true
spring.datasource.url=jdbc:h2:mem:testdb
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=admin
spring.datasource.password=admin
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.jpa.hibernate.ddl-auto=none
I tried to configure my application.properties in a couple of ways that were listed:
//Configuration 1
spring.datasource.schema=classpath:data.sql
//Configuration 2
spring.sql.init.schema-locations=classpath:data.sql
//Configuration 3
spring.datasource.data=classpath:data.sql
//Configuration 4
spring.sql.init.data-locations=classpath:data.sql
None of them worked, I also tried to configure a DataSource Bean, which seemed to have done something different, since the logs didn't show h2 memory database starting up before, now the logs show this:
2022-06-25 18:46:25.826 INFO 5303 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2022-06-25 18:46:25.840 INFO 5303 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 8 ms. Found 0 JPA repository interfaces.
2022-06-25 18:46:26.413 INFO 5303 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8081 (http)
2022-06-25 18:46:26.419 INFO 5303 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2022-06-25 18:46:26.419 INFO 5303 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.56]
2022-06-25 18:46:26.467 INFO 5303 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2022-06-25 18:46:26.467 INFO 5303 --- [ restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1335 ms
2022-06-25 18:46:26.568 INFO 5303 --- [ restartedMain] o.s.b.a.h2.H2ConsoleAutoConfiguration : H2 console available at '/h2-console'. Database available at 'jdbc:h2:mem:testdb'
2022-06-25 18:46:26.725 INFO 5303 --- [ restartedMain] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2022-06-25 18:46:26.747 INFO 5303 --- [ restartedMain] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.6.4.Final
2022-06-25 18:46:26.857 INFO 5303 --- [ restartedMain] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
2022-06-25 18:46:26.906 INFO 5303 --- [ restartedMain] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
2022-06-25 18:46:26.993 INFO 5303 --- [ restartedMain] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
The DataSource Bean :
#Bean
public DriverManagerDataSource dataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("org.h2.Driver");
dataSource.setUrl("jdbc:h2:mem:testdb");
dataSource.setUsername("admin");
dataSource.setPassword("admin");
// schema init
Resource initSchema = new ClassPathResource("data.sql");
DatabasePopulator databasePopulator = new ResourceDatabasePopulator(initSchema);
DatabasePopulatorUtils.execute(databasePopulator, dataSource);
return dataSource;
}
What am I missing here? Thanks!
EDIT I fixed the issue:
I found this post on github and it seemed relevant since my hikariPool wasn't starting up, I checked one of the answers where you configure the hikaripool as a bean, like this :
#Bean
public HikariDataSource createHikariConfig() {
HikariConfig hikariConfig = new HikariConfig();
hikariConfig.setDriverClassName("org.h2.Driver");
hikariConfig.setJdbcUrl("jdbc:h2:mem:testdb");
hikariConfig.setUsername("admin");
hikariConfig.setPassword("admin");
return new HikariDataSource(hikariConfig);
}
This made the hikariPool startup and execute the schema.sql script file under my src/main/resources, and now it is working.
You've disabled schema generation with
spring.jpa.hibernate.ddl-auto=none
Set it to create and it should work with the default schema.sql or import.sql
For reference, these are the possible values you can set it to:
none: No action will be performed
create-only: Database creation will be generated
drop: Database dropping will be generated
create: Database dropping will be generated followed by database creation.
create-drop: Drop the schema and recreate it on SessionFactory startup. Additionally, drop the schema on SessionFactory shutdown
validate: Validate the database schema
update: Update the database schema

spring cloud stream kafka consumer clientId anonymous

I am new to kafka with spring cloud stream.the application is in two in one.
the first application is producing to kafka topic (com.ng.vela.even.card_verified) which is very accurate but the second one is give me the following in my console but messages are not being comsumed from the kafka topic.
This is what am getting in my console .
020-06-24 14:36:07.168 INFO 7784 --- [container-0-C-1] o.a.k.c.c.internals.AbstractCoordinator : [Consumer clientId=consumer-anonymous.1bf08674-d2fd-447a-b7d6-ce0c9eb597e9-24, groupId=anonymous.1bf08674-d2fd-447a-b7d6-ce0c9eb597e9] Successfully joined group with generation 1
2020-06-24 14:36:07.170 INFO 7784 --- [container-0-C-1] o.a.k.c.c.internals.ConsumerCoordinator : [Consumer clientId=consumer-anonymous.1bf08674-d2fd-447a-b7d6-ce0c9eb597e9-24, groupId=anonymous.1bf08674-d2fd-447a-b7d6-ce0c9eb597e9] Adding newly assigned partitions: com.ng.vela.even.card_verified-0
2020-06-24 14:36:07.171 INFO 7784 --- [ restartedMain] .ConditionEvaluationDeltaLoggingListener : Condition evaluation unchanged
2020-06-24 14:36:07.171 INFO 7784 --- [container-0-C-1] o.a.k.c.c.internals.ConsumerCoordinator : [Consumer clientId=consumer-anonymous.1bf08674-d2fd-447a-b7d6-ce0c9eb597e9-24, groupId=anonymous.1bf08674-d2fd-447a-b7d6-ce0c9eb597e9] Found no committed offset for partition com.ng.vela.even.card_verified-0
2020-06-24 14:36:07.173 INFO 7784 --- [container-0-C-1] o.a.k.c.c.internals.ConsumerCoordinator : [Consumer clientId=consumer-anonymous.1bf08674-d2fd-447a-b7d6-ce0c9eb597e9-24, groupId=anonymous.1bf08674-d2fd-447a-b7d6-ce0c9eb597e9] Found no committed offset for partition com.ng.vela.even.card_verified-0
2020-06-24 14:36:07.180 INFO 7784 --- [container-0-C-1] o.a.k.c.c.internals.SubscriptionState : [Consumer clientId=consumer-anonymous.1bf08674-d2fd-447a-b7d6-ce0c9eb597e9-24, groupId=anonymous.1bf08674-d2fd-447a-b7d6-ce0c9eb597e9] Resetting offset for partition com.ng.vela.even.card_verified-0 to offset 63.
2020-06-24 14:36:07.183 INFO 7784 --- [container-0-C-1] o.s.c.s.b.k.KafkaMessageChannelBinder$1 : anonymous.1bf08674-d2fd-447a-b7d6-ce0c9eb597e9: partitions assigned: [com.ng.vela.even.card_verified-0]
the java source code is this below cos I am trying to follow the documentation of spring cloud stream :
package com.mint.financial;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.cloud.stream.messaging.Processor;
import org.springframework.context.annotation.Bean;
import org.springframework.messaging.handler.annotation.SendTo;
import com.mint.financial.entity.CardSchemeStream;
import com.mint.financial.kafka.consumer.CardSchemeKafkaConsumer;
#SpringBootApplication
#EnableBinding(Processor.class)
public class MintFinancialClientConsumerApplication {
public static void main(String[] args) {
SpringApplication.run(MintFinancialClientConsumerApplication.class, args);
}
#StreamListener(Processor.INPUT)
#SendTo(Processor.OUTPUT)
public String handle(String value) {
System.out.println("Received: " + value);
return value ;
}
#Bean
public CardSchemeStream getCardSchemeStream() {
return new CardSchemeStream() ;
}
#Bean
public ApplicationRunner initializeConnection(){
return args -> {
System.out.println("handler testing for api working also with application runner");
};
}
}
The pom is
<?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.3.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.mint</groupId>
<artifactId>MintFinance</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>MintFinancialClientConsumer</name>
<description>Visa Validation project Consumer for mint financial technology</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb-reactive</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream</artifactId>
<version>3.0.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-binder-kafka</artifactId>
<version>3.0.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</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>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
The application.properties file is
spring.data.mongodb.host=localhost
spring.data.mongodb.port=27017
spring.data.mongodb.repositories.enabled=true
spring.data.mongodb.database=mint
spring.cloud.stream.kafka.binders.broker=9092
spring.cloud.stream.kafka.binder.zkNodes=2181
spring.cloud.stream.input.group.name=test-consumer-group
spring.cloud.stream.bindings.output.destination=com.ng.vela.even.card_verified
spring.cloud.stream.bindings.input.destination=com.ng.vela.even.card_verified
#spring.cloud.stream.bindings.input.destination=first-topic
#spring.cloud.stream.bindings.output.destination=first-topic
spring.cloud.stream.bindings.output.producer.partitionCount=1
spring.cloud.stream.bindings.output.content-type=text/plain
spring.cloud.stream.bindings.output.producer.headerMode=headers
As shown above, every other thing is working including the connection to mongodb
but i cant just consume messages that i have produced to kafka.I am trying to produce and consume from the same topic.
I have even considered using the default consumer group due to the error, but all to no avail.
Again,I changed the replication factor in server.properties file to 3 but yet nothing is working.
I have searched everywhere . please guys i need your help .

Spring boot:connection oracle database

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
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

Spring Boot wont start Tomcat

I am new in spring boot framework. I tried a simple scratch application but my embedded tomcat wont startup. Also i downloaded source code from spring boot initialize, same application is running smoothly in another system but giving error in my system.
My pom.xml file
<?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.sokka</groupId>
<artifactId>Sokka</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Sokka</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.1.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>
</properties>
<dependencies>
<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>
<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>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
My Java File
package com.sokka.Sokka;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
#SpringBootApplication
public class SokkaApplication {
public static void main(String[] args) {
SpringApplication.run(SokkaApplication.class, args);
}
}
The same Application is running in another system but not running in my system.
The error message that I get is:
018-04-20 11:42:22.969 INFO 31454 --- [ restartedMain] com.sokka.Sokka.SokkaApplication : Starting SokkaApplication on hero-HP-Pavilion-Notebook with PID 31454 (/home/hero/Projects/Sokka/target/classes started by hero in /home/hero/Projects/Sokka)
2018-04-20 11:42:22.970 INFO 31454 --- [ restartedMain] com.sokka.Sokka.SokkaApplication : No active profile set, falling back to default profiles: default
2018-04-20 11:42:23.015 INFO 31454 --- [ restartedMain] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext#530af565: startup date [Fri Apr 20 11:42:23 NPT 2018]; root of context hierarchy
2018-04-20 11:42:23.939 INFO 31454 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
2018-04-20 11:42:23.962 INFO 31454 --- [ restartedMain] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2018-04-20 11:42:23.975 INFO 31454 --- [ restartedMain] com.sokka.Sokka.SokkaApplication : Started SokkaApplication in 1.239 seconds (JVM running for 1.618)
2018-04-20 11:42:23.980 INFO 31454 --- [ Thread-8] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext#530af565: startup date [Fri Apr 20 11:42:23 NPT 2018]; root of context hierarchy
2018-04-20 11:42:23.986 INFO 31454 --- [ Thread-8] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown

Openshift spring boot deploy fails

I am deploying a simple spring boot application in open shift
But fails after build success.
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.example</groupId>
<artifactId>springdemo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>springdemo</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.1.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>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Add tomcat only if I want to run directly -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>springdemo</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
AppMain
#SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
Controller
#RestController
public class SampleController {
#GetMapping("/test")
public String test(){
return "Spring Boot running......";
}
}
all this on git when I start pulling from OpenShift it build success but after get error and not deployed.
I have selected Java and Redhut jboss(tomcat 8)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2:15.524s
[INFO] Finished at: Sat Mar 04 12:24:08 UTC 2017
/usr/bin/mvn: line 9: 33 Killed $M2_HOME/bin/mvn "$#"
Aborting due to error code 137 from Maven build
error: build error: non-zero (13) exit code from registry.access.redhat.com/jboss-webserver-3/webserver30-tomcat8-openshift#sha256:727603994024d133ead698832e07xxxxxxxxxxxxxxxxxxxxxxxx
Check the resources tag in the build yaml file.
If not add resources like below
resources:
limits:
cpu: '2'
memory: 2Gi
requests:
cpu: '1'
memory: 1Gi

Resources