HikariPool-1 - Exception during pool initialization. Trying to build Spring boot application using MySQL docker image - java

I am trying to create a application using Spring boot and MySQL.
The application is running successfully when working on local server, but when try to trying to create docker image the service is throwing Exception during pool initialization error.
Below are my project config
Spring boot version: 3.0.1
Java version: 17
MySQL version: 8
application properties
server.port=3005
spring.application.name=user-service
spring.datasource.url=jdbc:mysql://localhost:3307/bank_app?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC
spring.datasource.username=root
spring.datasource.password=123456
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update
spring.jpa.generate-ddl=true
docker-compose.yml
version: "3.8"
services:
mysqldb:
image: mysql:latest
container_name: mysqldb
restart: unless-stopped
env_file: ./.env
environment:
- MYSQL_ROOT_PASSWORD=123456
- MYSQL_DATABASE=bank_app
- MYSQL_USER=root
- MYSQL_PASSWORD=123456
ports:
- 3307:3306
volumes:
- db:/var/lib/mysql
networks:
- main-network
user-service:
build:
context: ../code/user-service
dockerfile: Dockerfile
image: user-service
container_name: user-service
restart: on-failure
depends_on:
- mysqldb
ports:
- 3005:3005
environment:
- SPRING_PROFILES_ACTIVE=prod
- SPRING_APPLICATION_NAME=user-service
- SPRING_APPLICATION_JSON={"eureka":{"client":{"serviceUrl":{"defaultZone":"http://eureka-service:8761/eureka"}}}}
networks:
- main-network
networks:
main-network:
external:
name: main-network
volumes:
db:
pom.xml
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-core</artifactId>
<version>6.1.7.Final</version>
<type>pom</type>
</dependency>
I tried by replacing the localhost with container name mysqldb in the datasource URL but still I'm facing same error
Issue
2023-02-14 22:44:07 2023-02-14T17:14:07.221Z INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 3005 (http)
2023-02-14 22:44:07 2023-02-14T17:14:07.292Z INFO 1 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2023-02-14 22:44:07 2023-02-14T17:14:07.293Z INFO 1 --- [ main] o.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/10.1.4]
2023-02-14 22:44:08 2023-02-14T17:14:08.255Z INFO 1 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2023-02-14 22:44:08 2023-02-14T17:14:08.294Z INFO 1 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 18593 ms
2023-02-14 22:44:10 2023-02-14T17:14:10.390Z INFO 1 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2023-02-14 22:44:11 2023-02-14T17:14:11.085Z INFO 1 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 6.1.6.Final
2023-02-14 22:44:13 2023-02-14T17:14:13.010Z WARN 1 --- [ main] org.hibernate.orm.deprecation : HHH90000021: Encountered deprecated setting [javax.persistence.sharedCache.mode], use [jakarta.persistence.sharedCache.mode] instead
2023-02-14 22:44:13 2023-02-14T17:14:13.810Z INFO 1 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2023-02-14 22:44:15 2023-02-14T17:14:15.664Z ERROR 1 --- [ main] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Exception during pool initialization.
2023-02-14 22:44:15
2023-02-14 22:44:15 com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
2023-02-14 22:44:15
2023-02-14 22:44:15 The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
2023-02-14 22:44:15 at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174) ~[mysql-connector-j-8.0.31.jar!/:8.0.31]
2023-02-14 22:44:15 at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64) ~[mysql-connector-j-8.0.31.jar!/:8.0.31]
2023-02-14 22:44:15 at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:828) ~[mysql-connector-j-8.0.31.jar!/:8.0.31]
2023-02-14 22:44:15 at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:448) ~[mysql-connector-j-8.0.31.jar!/:8.0.31]
2023-02-14 22:44:15 at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:241) ~[mysql-connector-j-8.0.31.jar!/:8.0.31]
2023-02-14 22:44:15 at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:198) ~[mysql-connector-j-8.0.31.jar!/:8.0.31]
2023-02-14 22:44:15 at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138) ~[HikariCP-5.0.1.jar!/:na]
2023-02-14 22:44:15 at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:359) ~[HikariCP-5.0.1.jar!/:na]
2023-02-14 22:44:15 at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:201) ~[HikariCP-5.0.1.jar!/:na]
2023-02-14 22:44:15 at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:470) ~[HikariCP-5.0.1.jar!/:na]
2023-02-14 22:44:15 at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561) ~[HikariCP-5.0.1.jar!/:na]
2023-02-14 22:44:15 at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:100) ~[HikariCP-5.0.1.jar!/:na]
2023-02-14 22:44:15 at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112) ~[HikariCP-5.0.1.jar!/:na]
2023-02-14 22:44:15 at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:122) ~[hibernate-core-6.1.6.Final.jar!/:6.1.6.Final]
2023-02-14 22:44:15 at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcEnvironmentInitiator.java:284) ~[hibernate-core-6.1.6.Final.jar!/:6.1.6.Final]
2023-02-14 22:44:15 at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:177) ~[hibernate-core-6.1.6.Final.jar!/:6.1.6.Final]

Your port mapping for mysqldb is maybe not needed? That is unless you really want to expose MySQL's server to the outside world (outside:inside). In your case on port 3307.
ports:
- 3307:3306
I'm not sure if you really mean to expose your server, but inside of your container you should be using the real port, localhost:3306.

I solved this issue by adding the following lines in the docker-compose.yml files.
- SPRING_DATASOURCE_URL=jdbc:mysql://mysqldb:3306/bank_app?useSSL=false
- SPRING_DATASOURCE_USERNAME=root
- SPRING_DATASOURCE_PASSWORD=123456
- SPRING_JPA_PROPERTIES_HIBERNATE_DIALECT=org.hibernate.dialect.MySQLDialect
- SPRING_JPA_PROPERTIES_DDL_AUTO=update
The new docker-compose.yml file looks like this
version: "3.8"
services:
mysqldb:
image: mysql:latest
container_name: mysqldb
restart: unless-stopped
env_file: ./.env
environment:
- MYSQL_ROOT_PASSWORD=123456
- MYSQL_DATABASE=bank_app
- MYSQL_USER=root
- MYSQL_PASSWORD=123456
ports:
- 3307:3306
volumes:
- db:/var/lib/mysql
networks:
- main-network
user-service:
build:
context: ../code/user-service
dockerfile: Dockerfile
image: user-service
container_name: user-service
restart: on-failure
depends_on:
- mysqldb
ports:
- 3005:3005
environment:
- SPRING_PROFILES_ACTIVE=prod
- SPRING_APPLICATION_NAME=user-service
- SPRING_DATASOURCE_URL=jdbc:mysql://mysqldb:3306/bank_app?useSSL=false
- SPRING_DATASOURCE_USERNAME=root
- SPRING_DATASOURCE_PASSWORD=123456
- SPRING_JPA_PROPERTIES_HIBERNATE_DIALECT=org.hibernate.dialect.MySQLDialect
- SPRING_JPA_PROPERTIES_DDL_AUTO=update
- SPRING_APPLICATION_JSON={"eureka":{"client":{"serviceUrl":{"defaultZone":"http://eureka-service:8761/eureka"}}}}
networks:
- main-network
networks:
main-network:
external:
name: main-network
volumes:
db:

Related

Feign retryable exception error in Docker

I have created 4 services Eureka service, Gateway service, Authentication service and User service. Authentication and User service are routing through gateway service on port 8000 and FeignClient is used to communicate between Auth and User service for creating user and authentication.
My services are running fine on local server but when docker images are created I'm getting a Feign retryable exception error.
docker-compose.yml file
version: "3.8"
services:
mysqldb:
image: mysql:5.7
restart: unless-stopped
env_file: ./.env
environment:
- MYSQL_ROOT_PASSWORD=123456
- MYSQL_DATABASE=bank_app
ports:
- 3307:3306
volumes:
- db:/var/lib/mysql
networks:
- main-network
eureka-service:
build:
context: ../code/eureka-service
dockerfile: Dockerfile
image: eureka-service
container_name: eureka-service
restart: on-failure
ports:
- 8761:8761
environment:
- SPRING_PROFILES_ACTIVE=prod
- SPRING_APPLICATION_NAME=eureka-service
networks:
- main-network
gateway-service:
build:
context: ../code/gateway-service
dockerfile: Dockerfile
image: gateway-service
container_name: gateway-service
restart: on-failure
ports:
- 8000:8000
environment:
- SPRING_PROFILES_ACTIVE=prod
- SPRING_APPLICATION_NAME=gateway-service
- SPRING_APPLICATION_JSON={"eureka":{"client":{"serviceUrl":{"defaultZone":"http://eureka-service:8761/eureka"}}}}
networks:
- main-network
authentication-authorization-service:
build:
context: ../code/authentication-authorization-service
dockerfile: Dockerfile
image: authentication-authorization-service
container_name: authentication-authorization-service
restart: on-failure
ports:
- 3000:3000
environment:
- SPRING_PROFILES_ACTIVE=prod
- SPRING_APPLICATION_NAME=authentication-authorization-service
- SPRING_APPLICATION_JSON={"eureka":{"client":{"serviceUrl":{"defaultZone":"http://eureka-service:8761/eureka"}}}}
networks:
- main-network
user-service:
build:
context: ../code/user-service
dockerfile: Dockerfile
image: user-service
container_name: user-service
restart: on-failure
depends_on:
- mysqldb
ports:
- 3005:3005
environment:
- SPRING_PROFILES_ACTIVE=prod
- SPRING_APPLICATION_NAME=user-service
- SPRING_DATASOURCE_URL=jdbc:mysql://mysqldb:3306/bank_app?useSSL=false
- SPRING_DATASOURCE_USERNAME=root
- SPRING_DATASOURCE_PASSWORD=123456
- SPRING_JPA_PROPERTIES_HIBERNATE_DIALECT=org.hibernate.dialect.MySQLDialect
- SPRING_JPA_PROPERTIES_DDL_AUTO=update
- SPRING_APPLICATION_JSON={"eureka":{"client":{"serviceUrl":{"defaultZone":"http://eureka-service:8761/eureka"}}}}
networks:
- main-network
networks:
main-network:
external:
name: $NETWORK_NAME
volumes:
db:
application.properties file for Eureka and Gateway service is as follows
application.properties file for Eureka-service
spring.application.name=eureka-service
server.port=8761
eureka.client.register-with-eureka=false
eureka.client.fetch-registry=false
application.properties file for Gateway-service
spring.application.name=gateway-service
server.port=8000
security.enable-csrf=false
spring.main.web-application-type=reactive
spring.main.allow-bean-definition-overriding=true
user-service.path=/api/v1/users/**
user-service.uri=http://localhost:3005
authentication-authorization-service.path=/api/v1/auth/**
authentication-authorization-service.uri=http://localhost:3000
eureka.client.serviceUrl.defaultZone= http://localhost:8761/eureka
eureka.client.instance.preferIpAddress = true
The following stack trace is generated
2023-02-17 16:22:28 2023-02-17 10:52:28.540 INFO 1 --- [ main] c.m.g.GatewayServiceApplication : Started GatewayServiceApplication in 236.273 seconds (JVM running for 242.047)
2023-02-17 16:27:12 2023-02-17 10:57:12.251 ERROR 1 --- [or-http-epoll-3] a.w.r.e.AbstractErrorWebExceptionHandler : [5d73c5ea] 500 Server Error for HTTP POST "/api/v1/auth/signup"
2023-02-17 16:27:12
2023-02-17 16:27:12 io.netty.channel.AbstractChannel$AnnotatedConnectException: finishConnect(..) failed: Connection refused: localhost/127.0.0.1:3000
2023-02-17 16:27:12 Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException:
2023-02-17 16:27:12 Error has been observed at the following site(s):
2023-02-17 16:27:12 *__checkpoint ⇢ org.springframework.web.cors.reactive.CorsWebFilter [DefaultWebFilterChain]
2023-02-17 16:27:12 *__checkpoint ⇢ org.springframework.cloud.gateway.filter.WeightCalculatorWebFilter [DefaultWebFilterChain]
2023-02-17 16:27:12 *__checkpoint ⇢ HTTP POST "/api/v1/auth/signup" [ExceptionHandlingWebHandler]

SpringBoot RabbitMq connection error Broker not available; cannot force queue declarations during start, Consumer raised exception

I'm trying to add RabbitMq on my MSA project, but I have an issue with it.
I installed Erlang and RabbitMq, and rabbitMq Server is running with no problem.
The versions of Erlang is 25.0 and RabbitMq is 3.10.7.
This is rabbitMQ management webpage Image which is http://127.0.0.1:15672/
enter image description here
But when I run my Spring Boot Config server, server failed with connecting rabbitMq Server and keep trying attempting to Connect.
Here is the log.
2022-08-12 23:35:54.454 INFO 36128 --- [ main]
o.s.a.r.c.CachingConnectionFactory : Attempting to connect to:
[127.0.0.1:5672] 2022-08-12 23:35:56.504 INFO 36128 --- [
main] o.s.c.stream.binder.BinderErrorChannel : Channel
'springCloudBus.anonymous.hOplXZMfQYq2Ybop24hkJQ.errors' has 1
subscriber(s). 2022-08-12 23:35:56.504 INFO 36128 --- [
main] o.s.c.stream.binder.BinderErrorChannel : Channel
'springCloudBus.anonymous.hOplXZMfQYq2Ybop24hkJQ.errors' has 2
subscriber(s). 2022-08-12 23:35:56.505 INFO 36128 --- [
main] o.s.a.r.c.CachingConnectionFactory : Attempting to connect
to: [127.0.0.1:5672] 2022-08-12 23:35:58.548 INFO 36128 --- [
main] o.s.a.r.l.SimpleMessageListenerContainer : Broker not available;
cannot force queue declarations during start:
java.net.ConnectException: Connection refused: connect 2022-08-12
23:35:58.554 INFO 36128 --- [Yq2Ybop24hkJQ-1]
o.s.a.r.c.CachingConnectionFactory : Attempting to connect to:
[127.0.0.1:5672] 2022-08-12 23:36:00.590 INFO 36128 --- [
main] o.s.i.a.i.AmqpInboundChannelAdapter : started bean
'inbound.springCloudBus.anonymous.hOplXZMfQYq2Ybop24hkJQ' 2022-08-12
23:36:00.606 INFO 36128 --- [ main]
o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s):
8888 (http) with context path '' 2022-08-12 23:36:01.356 INFO 36128
--- [ main] o.s.i.monitor.IntegrationMBeanExporter : Registering MessageChannel
springCloudBus.anonymous.hOplXZMfQYq2Ybop24hkJQ.errors 2022-08-12
23:36:01.443 INFO 36128 --- [ main]
c.e.c.ConfigServiceApplication : Started
ConfigServiceApplication in 15.963 seconds (JVM running for 17.057)
2022-08-12 23:36:05.632 WARN 36128 --- [Yq2Ybop24hkJQ-1]
o.s.a.r.l.SimpleMessageListenerContainer : Consumer raised exception,
processing can restart if the connection factory supports it.
Exception summary: org.springframework.amqp.AmqpConnectException:
java.net.ConnectException: Connection refused: connect 2022-08-12
23:36:05.634 INFO 36128 --- [Yq2Ybop24hkJQ-1]
o.s.a.r.l.SimpleMessageListenerContainer : Restarting
Consumer#4a5066f5: tags=[[]], channel=null, acknowledgeMode=AUTO local
queue size=0
All I changed in config server is application.yml and build.gradle.
It's my gradle file source
plugins {
id 'org.springframework.boot' version '2.7.2'
id 'io.spring.dependency-management' version '1.0.12.RELEASE'
id 'java'
}
group = 'com.sample'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'
repositories {
mavenCentral()
}
ext {
set('springCloudVersion', "2021.0.3")
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-amqp'
implementation 'org.springframework.cloud:spring-cloud-bus'
implementation 'org.springframework.cloud:spring-cloud-stream-binder-rabbit'
implementation 'org.springframework.cloud:spring-cloud-config-server'
implementation 'org.springframework.cloud:spring-cloud-starter'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.amqp:spring-rabbit-test'
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}
tasks.named('test') {
useJUnitPlatform()
}
And here is my yml file source
server:
port: 8888
spring:
application:
name: config-service
rabbitmq:
dynamic: true
host: 127.0.0.1
port: 5672
username: guest
password: guest
profiles:
active: git
cloud:
config:
server:
native:
search-locations: file://C:/${user.home}/Desktop/develop/native-file-repo
git:
uri: https://github.com/***/***.git
management:
endpoints:
web:
exposure:
include: health, busrefresh
I tried to find the solution for couple days, but couldn't find it yet.

spring boot is not creating table from entity using postgres container

I'm trying to create a spring boot microservice with a postgres database, the connection to database is done but the tables from entities are not created. Anyone help me please!
I have postgres in a container:
this is my application.yml:
server:
port: 8080
spring:
application:
name: mpService
datasource:
url: jdbc:postgresql://localhost:5432/mpservice
username: farah
password: ****
jpa:
properties:
hibernate:
dialect: org.hibernate.dialect.PostgreSQLDialect
format_sql: true
hibernate:
ddl-auto: update
show-sql: true
This is the Entity :
import lombok.*;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import javax.persistence.Entity;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
#Builder
#NoArgsConstructor
#AllArgsConstructor
#Setter
#Getter
#Entity
#Table(name = "projects")
public class Project implements Serializable {
#Id
#SequenceGenerator(
name= "project_id_sequence",
sequenceName = "project_id_sequence"
)
#GeneratedValue(
strategy = GenerationType.SEQUENCE,
generator = "project_id_sequence"
)
Long idP;
String nomP;
#Enumerated(EnumType.STRING)
CategoryP categoryP;
String descriptionP;
#Temporal(TemporalType.DATE)
Date dateDebutP;
#Temporal(TemporalType.DATE)
Date dateFinP;
double budget;
}
dependencies :
<dependencies>
<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.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
</dependencies>
Docker-compose with which i created the containers:
services:
postgres:
container_name: postgres
image: postgres
environment:
POSTGRES_USER: farah
POSTGRES_PASSWORD: ****
PGDATA: /data/postgres
volumes:
- postgres:/data/postgres
ports:
- "5432:5432"
networks:
- postgres
restart: unless-stopped
pgadmin:
container_name: pgadmin
image: dpage/pgadmin4
environment:
PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL:-pgadmin4#pgadmin.org}
PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD:-admin}
PGADMIN_CONFIG_SERVER_MODE: 'False'
volumes:
- pgadmin:/var/lib/pgadmin
ports:
- "5050:80"
networks:
- postgres
restart: unless-stopped
networks:
postgres:
driver: bridge
volumes:
postgres:
pgadmin:
Log:
,------. ,--. ,--. ,--. ,--.
| .--. ' | `.' | ,--,--,--. `--' ,---. ,--.--. ,---. ,---. ,---. ,--.--. ,--. ,--. `--' ,---. ,---.
| '--' | | |'.'| | | | ,--. | .--' | .--' | .-. | ( .-' | .-. : | .--' \ `' / ,--. | .--' | .-. :
| | --' | | | | | | | | | | \ `--. | | ' '-' ' .-' `) \ --. | | \ / | | \ `--. \ --.
`--' `--' `--' `--`--`--' `--' `---' `--' `---' `----' `----' `--' `--' `--' `---' `----'
2022-07-20 13:53:52.790 INFO 30816 --- [ main] com.cra.MpServiceApplication : Starting MpServiceApplication using Java 11.0.15 on DESKTOP-2DAHVVC with PID 30816
2022-07-20 13:53:52.794 INFO 30816 --- [ main] com.cra.MpServiceApplication : No active profile set, falling back to default profiles: default
2022-07-20 13:53:53.743 INFO 30816 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2022-07-20 13:53:53.829 INFO 30816 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 71 ms. Found 1 JPA repository interfaces.
2022-07-20 13:53:54.421 INFO 30816 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2022-07-20 13:53:54.430 INFO 30816 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2022-07-20 13:53:54.431 INFO 30816 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.55]
2022-07-20 13:53:54.531 INFO 30816 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2022-07-20 13:53:54.531 INFO 30816 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1670 ms
2022-07-20 13:53:54.662 INFO 30816 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2022-07-20 13:53:54.834 INFO 30816 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2022-07-20 13:53:54.881 INFO 30816 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2022-07-20 13:53:54.928 INFO 30816 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.32.Final
2022-07-20 13:53:55.085 INFO 30816 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
2022-07-20 13:53:55.252 INFO 30816 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.PostgreSQL10Dialect
2022-07-20 13:53:55.749 INFO 30816 --- [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2022-07-20 13:53:55.761 INFO 30816 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2022-07-20 13:53:56.036 WARN 30816 --- [ main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2022-07-20 13:53:56.347 INFO 30816 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2022-07-20 13:53:56.359 INFO 30816 --- [ main] com.cra.MpServiceApplication : Started MpServiceApplication in 4.193 seconds (JVM running for 5.827)
It took me a while because I hate yaml but it should it's wrong.
this is the correct file:
server:
port: 8080
spring:
application:
name: mpService
datasource:
url: jdbc:postgresql://localhost:5432/mpservice
username: farah
password: ****
jpa:
properties:
hibernate:
dialect: org.hibernate.dialect.PostgreSQLDialect
format_sql: true
hibernate:
ddl-auto: update
show-sql: true
JPA is its own node it's not under datasource.
Try this on you JPA config
spring:
datasource:
driver-class-name: org.postgresql.Driver
url: jdbc:postgresql://localhost:5432/mpservice
username: farah
password: ****
platform: postgres
initialization-mode: always
continue-on-error: true
jpa:
show-sql: true
generate-ddl: true
hibernate:
ddl-auto: auto
database: postgresql

Bad Gateway when trying to access to http://sge-api.local via minikube / traefik

I'm trying to deploy a SpringBoot app in local with Kubernetes and Traefik, with local url.
I already checked the pod, and the logs are OK, it seems the app is waiting for my calls.
But when I use Postman to call:
GET http://sge-api.local/points/12345/search
I get:
502 Bad Gateway
Here is my config:
Service:
➜ sge git:(master) ✗ kubectl get service -n sge
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
sge-api-local ClusterIP 10.109.84.138 <none> 8888/TCP 75m
Ingress:
➜ sge git:(master) ✗ kubectl get ingress -n sge
NAME HOSTS ADDRESS PORTS AGE
my-ingress sge-api.local 80 75m
Pod:
➜ sge git:(master) ✗ kubectl get logs -n sge sge-api-local-66d77d54ff-6fwc5
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.2.0.RELEASE)
2019-10-25 14:51:39.508 INFO 1 --- [ main] com.xxx.sge.MainApplication : Starting MainApplication on sge-api-local-66d77d54ff-6fwc5 with PID 1 (/myapp.jar started by root in /)
2019-10-25 14:51:39.705 INFO 1 --- [ main] com.xxx.sge.MainApplication : No active profile set, falling back to default profiles: default
2019-10-25 14:53:09.205 INFO 1 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.ws.config.annotation.DelegatingWsConfiguration' of type [org.springframework.ws.config.annotation.DelegatingWsConfiguration$$EnhancerBySpringCGLIB$$5ed484ef] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-10-25 14:53:10.704 INFO 1 --- [ main] .w.s.a.s.AnnotationActionEndpointMapping : Supporting [WS-Addressing August 2004, WS-Addressing 1.0]
2019-10-25 14:53:39.002 INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8081 (https)
2019-10-25 14:53:41.107 INFO 1 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2019-10-25 14:53:41.203 INFO 1 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.27]
2019-10-25 14:53:50.004 INFO 1 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2019-10-25 14:53:50.004 INFO 1 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 125302 ms
2019-10-25 14:54:47.609 INFO 1 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2019-10-25 14:55:47.302 INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8081 (https) with context path ''
2019-10-25 14:55:47.902 INFO 1 --- [ main] com.xxx.sge.MainApplication : Started MainApplication in 280.601 seconds (JVM running for 326.759)
My app also appears OK in traefik dashboard.
I have others app that also run in .local url
I also have set an entry in /etc/hosts with sge-api.local to 127.0.0.1
Here is my ingress:
kind: Ingress
apiVersion: extensions/v1beta1
metadata:
name: sge-ingress
namespace: sge
annotations:
kubernetes.io/ingress.class: traefik
spec:
rules:
- host: sge-api.local
http:
paths:
- backend:
serviceName: sge-api-local
servicePort: 8888
My service :
apiVersion: v1
kind: Service
metadata:
labels:
app: sge-api-local
name: sge-api-local
namespace: sge
spec:
ports:
- name: "8888"
port: 8888
targetPort: 8888
selector:
app: sge-api-local
My deployment:
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
reloader.stakater.com/auto: "true"
labels:
app: sge-api-local
name: sge-api-local
namespace: sge
spec:
selector:
matchLabels:
app: sge-api-local
replicas: 1
strategy:
type: Recreate
template:
metadata:
labels:
app: sge-api-local
spec:
containers:
- image: sge_api:local
name: sge-api-local
What should I do to debug this ?
You have the spring application running with listening port 8081, this will not work.
2019-10-25 14:53:39.002 INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8081 (https)
Adjust your service to use target port 8081 instead of 8888

Apache Ignite Loading Twice with Spring-Boot?

I'm prototyping something with Spring-Boot 1.2.7.RELEASE and Apache Ignite 1.4.0 and noticed something a little odd, maybe it's a just a logging configuration.
It looks like Apache Ignite is trying to start twice with Spring? If I comment out the SpringApplication.run line then it looks like it only starts once. Maybe I'm not using Spring with Apache Ignite correctly?
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>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>IgniteDemo</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.7.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<ignite.version>1.4.0</ignite.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.apache.ignite</groupId>
<artifactId>ignite-core</artifactId>
<version>${ignite.version}</version>
</dependency>
<dependency>
<groupId>org.apache.ignite</groupId>
<artifactId>ignite-spring</artifactId>
<version>${ignite.version}</version>
</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>
</project>
IgniteDemoApplication
package com.example;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteException;
import org.apache.ignite.Ignition;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
#SpringBootApplication
public class IgniteDemoApplication {
public static void main(String[] args) throws IgniteException {
//
// If I comment out this line then it only outputs one time.
// But then how would I have access to my application context?
//
SpringApplication.run(IgniteDemoApplication.class, args);
try(Ignite ignite = Ignition.start("C:\\opt\\apache-ignite-fabric-1.4.0-bin\\examples\\config\\example-ignite.xml")){
ignite.compute().broadcast(() -> System.out.println("Hello World!"));
}
}
}
Output
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.2.7.RELEASE)
2015-11-01 21:19:56.182 INFO 7024 --- [ main] com.example.IgniteDemoApplication : Starting IgniteDemoApplication on User-PC with PID 7024 (C:\Users\User\Documents\workspace-sts-3.7.0.RELEASE\IgniteDemo\target\classes started by User in C:\Users\User\Documents\workspace-sts-3.7.0.RELEASE\IgniteDemo)
2015-11-01 21:19:56.223 INFO 7024 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext#306279ee: startup date [Sun Nov 01 21:19:56 EST 2015]; root of context hierarchy
2015-11-01 21:19:56.963 INFO 7024 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2015-11-01 21:19:56.973 INFO 7024 --- [ main] com.example.IgniteDemoApplication : Started IgniteDemoApplication in 0.981 seconds (JVM running for 1.505)
2015-11-01 21:19:57.044 INFO 7024 --- [ main] o.s.b.f.xml.XmlBeanDefinitionReader : Loading XML bean definitions from URL [file:/C:/opt/apache-ignite-fabric-1.4.0-bin/examples/config/example-ignite.xml]
2015-11-01 21:19:57.164 INFO 7024 --- [ main] o.s.c.support.GenericApplicationContext : Refreshing org.springframework.context.support.GenericApplicationContext#6f6745d6: startup date [Sun Nov 01 21:19:57 EST 2015]; root of context hierarchy
2015-11-01 21:19:57.264 ERROR 7024 --- [ main] : Failed to resolve default logging config file: config/java.util.logging.properties
Console logging handler is not configured.
2015-11-01 21:19:57.325 INFO 7024 --- [ main] org.apache.ignite.internal.IgniteKernal :
>>> __________ ________________
>>> / _/ ___/ |/ / _/_ __/ __/
>>> _/ // (7 7 // / / / / _/
>>> /___/\___/_/|_/___/ /_/ /___/
>>>
>>> ver. 1.4.0#20150924-sha1:c2def5f6
>>> 2015 Copyright(C) Apache Software Foundation
>>>
>>> Ignite documentation: http://ignite.apache.org
[21:19:57] __________ ________________
[21:19:57] / _/ ___/ |/ / _/_ __/ __/
[21:19:57] _/ // (7 7 // / / / / _/
[21:19:57] /___/\___/_/|_/___/ /_/ /___/
[21:19:57]
[21:19:57] ver. 1.4.0#20150924-sha1:c2def5f6
[21:19:57] 2015 Copyright(C) Apache Software Foundation
[21:19:57]
[21:19:57] Ignite documentation: http://ignite.apache.org
[21:19:57]
[21:19:57] Quiet mode.
[21:19:57] ^-- To see **FULL** console log here add -DIGNITE_QUIET=false or "-v" to ignite.{sh|bat}
[21:19:57]
2015-11-01 21:19:57.325 INFO 7024 --- [ main] org.apache.ignite.internal.IgniteKernal : Config URL: file:/C:/opt/apache-ignite-fabric-1.4.0-bin/examples/config/example-ignite.xml
2015-11-01 21:19:57.325 INFO 7024 --- [ main] org.apache.ignite.internal.IgniteKernal : Daemon mode: off
2015-11-01 21:19:57.325 INFO 7024 --- [ main] org.apache.ignite.internal.IgniteKernal : OS: Windows 7 6.1 amd64
2015-11-01 21:19:57.325 INFO 7024 --- [ main] org.apache.ignite.internal.IgniteKernal : OS user: User
2015-11-01 21:19:57.325 INFO 7024 --- [ main] org.apache.ignite.internal.IgniteKernal : Language runtime: Java Platform API Specification ver. 1.8
2015-11-01 21:19:57.325 INFO 7024 --- [ main] org.apache.ignite.internal.IgniteKernal : VM information: Java(TM) SE Runtime Environment 1.8.0_60-b27 Oracle Corporation Java HotSpot(TM) 64-Bit Server VM 25.60-b23
2015-11-01 21:19:57.325 INFO 7024 --- [ main] org.apache.ignite.internal.IgniteKernal : VM total memory: 2.7GB
2015-11-01 21:19:57.325 INFO 7024 --- [ main] org.apache.ignite.internal.IgniteKernal : Remote Management [restart: off, REST: on, JMX (remote: on, port: 31718, auth: off, ssl: off)]
2015-11-01 21:19:57.325 INFO 7024 --- [ main] org.apache.ignite.internal.IgniteKernal : IGNITE_HOME=null
2015-11-01 21:19:57.325 INFO 7024 --- [ main] org.apache.ignite.internal.IgniteKernal : VM arguments: [-Dcom.sun.management.jmxremote, -Dcom.sun.management.jmxremote.port=31718, -Dcom.sun.management.jmxremote.authenticate=false, -Dcom.sun.management.jmxremote.ssl=false, -Dspring.liveBeansView.mbeanDomain, -Dspring.application.admin.enabled=true, -Dfile.encoding=UTF-8]
2015-11-01 21:19:57.325 INFO 7024 --- [ main] org.apache.ignite.internal.IgniteKernal : Configured caches ['ignite-marshaller-sys-cache', 'ignite-sys-cache', 'ignite-atomics-sys-cache']
2015-11-01 21:19:57.325 WARN 7024 --- [ main] org.apache.ignite.internal.IgniteKernal : Peer class loading is enabled (disable it in production for performance and deployment consistency reasons)
2015-11-01 21:19:57.335 WARN 7024 --- [te-#4%pub-null%] o.apache.ignite.internal.GridDiagnostic : Initial heap size is 192MB (should be no less than 512MB, use -Xms512m -Xmx512m).
[21:19:57] Initial heap size is 192MB (should be no less than 512MB, use -Xms512m -Xmx512m).
2015-11-01 21:19:58.601 INFO 7024 --- [ main] org.apache.ignite.internal.IgniteKernal : Non-loopback local IPs: 192.168.1.136, fe80:0:0:0:0:5efe:c0a8:188%net3, fe80:0:0:0:7942:8350:33cb:857e%eth3
2015-11-01 21:19:58.601 INFO 7024 --- [ main] org.apache.ignite.internal.IgniteKernal : Enabled local MACs: 00000000000000E0, 00248C37A502
[21:19:58] Configured plugins:
2015-11-01 21:19:58.601 INFO 7024 --- [ main] o.a.i.i.p.plugin.IgnitePluginProcessor : Configured plugins:
[21:19:58] ^-- None
2015-11-01 21:19:58.601 INFO 7024 --- [ main] o.a.i.i.p.plugin.IgnitePluginProcessor : ^-- None
[21:19:58]
2015-11-01 21:19:58.601 INFO 7024 --- [ main] o.a.i.i.p.plugin.IgnitePluginProcessor :
2015-11-01 21:19:58.802 INFO 7024 --- [ main] o.a.i.s.c.tcp.TcpCommunicationSpi : Successfully bound to TCP port [port=47101, locHost=0.0.0.0/0.0.0.0]
2015-11-01 21:19:59.872 WARN 7024 --- [ main] o.a.i.s.c.noop.NoopCheckpointSpi : Checkpoints are disabled (to enable configure any GridCheckpointSpi implementation)
2015-11-01 21:19:59.913 WARN 7024 --- [ main] o.a.i.i.m.c.GridCollisionManager : Collision resolution is disabled (all jobs will be activated upon arrival).
2015-11-01 21:19:59.913 WARN 7024 --- [ main] o.a.i.s.swapspace.noop.NoopSwapSpaceSpi : Swap space is disabled. To enable use FileSwapSpaceSpi.
[21:19:59] Security status [authentication=off, communication encryption=off]
2015-11-01 21:19:59.913 INFO 7024 --- [ main] org.apache.ignite.internal.IgniteKernal : Security status [authentication=off, communication encryption=off]
2015-11-01 21:20:00.083 INFO 7024 --- [ main] o.a.i.i.p.r.p.tcp.GridTcpRestProtocol : Command protocol successfully started [name=TCP binary, host=0.0.0.0/0.0.0.0, port=11212]
2015-11-01 21:20:00.133 INFO 7024 --- [ main] o.a.i.spi.discovery.tcp.TcpDiscoverySpi : Successfully bound to TCP port [port=47501, localHost=0.0.0.0/0.0.0.0]
2015-11-01 21:20:03.071 INFO 7024 --- [ main] o.a.i.i.p.cache.GridCacheProcessor : Started cache [name=ignite-sys-cache, mode=REPLICATED]
2015-11-01 21:20:03.084 INFO 7024 --- [ main] o.a.i.i.p.cache.GridCacheProcessor : Started cache [name=ignite-atomics-sys-cache, mode=PARTITIONED]
2015-11-01 21:20:03.098 INFO 7024 --- [ main] o.a.i.i.p.cache.GridCacheProcessor : Started cache [name=ignite-marshaller-sys-cache, mode=REPLICATED]
2015-11-01 21:20:03.224 INFO 7024 --- [ main] o.a.i.i.p.c.d.d.p.GridDhtPreloader : <ignite-sys-cache> Starting rebalancing in SYNC mode: ignite-sys-cache
2015-11-01 21:20:03.225 INFO 7024 --- [ main] o.a.i.i.p.c.d.d.p.GridDhtPreloader : <ignite-atomics-sys-cache> Starting rebalancing in SYNC mode: ignite-atomics-sys-cache
2015-11-01 21:20:03.225 INFO 7024 --- [ main] o.a.i.i.p.c.d.d.p.GridDhtPreloader : <ignite-marshaller-sys-cache> Starting rebalancing in SYNC mode: ignite-marshaller-sys-cache
2015-11-01 21:20:03.281 INFO 7024 --- [orker-#58%null%] o.a.i.i.p.c.d.d.p.GridDhtPreloader : <ignite-marshaller-sys-cache> Completed rebalancing in SYNC mode [cache=ignite-marshaller-sys-cache, time=50 ms]
2015-11-01 21:20:03.290 INFO 7024 --- [orker-#51%null%] o.a.i.i.p.c.d.d.p.GridDhtPreloader : <ignite-sys-cache> Completed rebalancing in SYNC mode [cache=ignite-sys-cache, time=70 ms]
2015-11-01 21:20:03.302 INFO 7024 --- [orker-#55%null%] o.a.i.i.p.c.d.d.p.GridDhtPreloader : <ignite-atomics-sys-cache> Completed rebalancing in SYNC mode [cache=ignite-atomics-sys-cache, time=70 ms]
[21:20:03] Performance suggestions for grid (fix if possible)
2015-11-01 21:20:03.349 INFO 7024 --- [ main] org.apache.ignite.internal.IgniteKernal : Performance suggestions for grid (fix if possible)
[21:20:03] To disable, set -DIGNITE_PERFORMANCE_SUGGESTIONS_DISABLED=true
2015-11-01 21:20:03.349 INFO 7024 --- [ main] org.apache.ignite.internal.IgniteKernal : To disable, set -DIGNITE_PERFORMANCE_SUGGESTIONS_DISABLED=true
[21:20:03] ^-- Disable peer class loading (set 'peerClassLoadingEnabled' to false)
2015-11-01 21:20:03.349 INFO 7024 --- [ main] org.apache.ignite.internal.IgniteKernal : ^-- Disable peer class loading (set 'peerClassLoadingEnabled' to false)
[21:20:03] ^-- Disable grid events (remove 'includeEventTypes' from configuration)
2015-11-01 21:20:03.349 INFO 7024 --- [ main] org.apache.ignite.internal.IgniteKernal : ^-- Disable grid events (remove 'includeEventTypes' from configuration)
[21:20:03]
2015-11-01 21:20:03.349 INFO 7024 --- [ main] org.apache.ignite.internal.IgniteKernal :
[21:20:03] To start Console Management & Monitoring run ignitevisorcmd.{sh|bat}
2015-11-01 21:20:03.350 INFO 7024 --- [ main] org.apache.ignite.internal.IgniteKernal : To start Console Management & Monitoring run ignitevisorcmd.{sh|bat}
[21:20:03]
[21:20:03] Ignite node started OK (id=a4028962)
2015-11-01 21:20:03.350 INFO 7024 --- [ main] org.apache.ignite.internal.IgniteKernal :
2015-11-01 21:20:03.351 INFO 7024 --- [ main] org.apache.ignite.internal.IgniteKernal :
>>> +----------------------------------------------------------------------+
>>> Ignite ver. 1.4.0#20150924-sha1:c2def5f647e410e9f25383d3e74f393e4d1348a5
>>> +----------------------------------------------------------------------+
>>> OS name: Windows 7 6.1 amd64
>>> CPU(s): 8
>>> Heap: 2.7GB
>>> VM name: 7024#User-PC
>>> Grid name: null
>>> Local node [ID=A4028962-807E-4011-BA64-B923B57DD8EA, order=14, clientMode=false]
>>> Local node addresses: [User-PC.cable.rcn.com/0:0:0:0:0:0:0:1, /127.0.0.1, /192.168.1.136]
>>> Local ports: TCP:11212 TCP:47101 UDP:47400 TCP:47501
[21:20:03] Topology snapshot [ver=14, servers=2, clients=0, CPUs=8, heap=3.7GB]
2015-11-01 21:20:03.352 INFO 7024 --- [ main] o.a.i.i.m.d.GridDiscoveryManager : Topology snapshot [ver=14, servers=2, clients=0, CPUs=8, heap=3.7GB]
2015-11-01 21:20:03.359 INFO 7024 --- [ main] o.a.i.i.m.d.GridDeploymentLocalStore : Class locally deployed: class com.example.IgniteDemoApplication
Hello World!
2015-11-01 21:20:03.442 INFO 7024 --- [ main] o.a.i.i.p.r.p.tcp.GridTcpRestProtocol : Command protocol successfully stopped: TCP binary
2015-11-01 21:20:03.459 WARN 7024 --- [-reader-#9%null] o.a.i.spi.discovery.tcp.TcpDiscoverySpi : Unknown connection detected (is some other software connecting to this Ignite port? missing SSL configuration on remote node?) [rmtAddr=/0:0:0:0:0:0:0:1]
[21:20:03] Unknown connection detected (is some other software connecting to this Ignite port? missing SSL configuration on remote node?) [rmtAddr=/0:0:0:0:0:0:0:1]
2015-11-01 21:20:03.466 INFO 7024 --- [ main] o.a.i.i.p.cache.GridCacheProcessor : Stopped cache: ignite-marshaller-sys-cache
2015-11-01 21:20:03.472 INFO 7024 --- [ main] o.a.i.i.p.cache.GridCacheProcessor : Stopped cache: ignite-sys-cache
2015-11-01 21:20:03.473 INFO 7024 --- [ main] o.a.i.i.p.cache.GridCacheProcessor : Stopped cache: ignite-atomics-sys-cache
2015-11-01 21:20:03.475 INFO 7024 --- [ main] o.a.i.i.m.d.GridDeploymentLocalStore : Removed undeployed class: GridDeployment [ts=1446430803215, depMode=SHARED, clsLdr=sun.misc.Launcher$AppClassLoader#18b4aac2, clsLdrId=ab87ef5c051-a4028962-807e-4011-ba64-b923b57dd8ea, userVer=0, loc=true, sampleClsName=org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionFullMap, pendingUndeploy=false, undeployed=true, usage=0]
[21:20:03] Ignite node stopped OK [uptime=00:00:00:132]
2015-11-01 21:20:03.482 INFO 7024 --- [ main] org.apache.ignite.internal.IgniteKernal :
>>> +---------------------------------------------------------------------------------+
>>> Ignite ver. 1.4.0#20150924-sha1:c2def5f647e410e9f25383d3e74f393e4d1348a5 stopped OK
>>> +---------------------------------------------------------------------------------+
>>> Grid name: null
>>> Grid uptime: 00:00:00:132
2015-11-01 21:20:03.600 INFO 7024 --- [ Thread-1] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext#306279ee: startup date [Sun Nov 01 21:19:56 EST 2015]; root of context hierarchy
2015-11-01 21:20:03.601 INFO 7024 --- [ Thread-1] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown
These are not "two instances", but two ways of how Ignite logs startup banner - one with STDOUT and another one with a built-in logger.
Just add ignite-slf4j dependency and use setGridLogger method of IgniteConfiguration to override the default logger - this message will disappear.
Actually Ignite starts once in both cases (with commented and uncommented SpringApplication.run line). Each Ignite node prints out current topology snapshot, but I see only one line about it in log:
Topology snapshot [ver=14, servers=2, clients=0, CPUs=8, heap=3.7GB]

Categories