I have written the following test while exploring spring webflux.
It's quite simple, i thought. Writing 10000 items and reading them again.
But somehow, sometimes a few are missing.
There no is no exception thrown just sometimes missing a few.
Is this a coding error or maybe a bug in mongo / reactor?
This is a basic spring boot setup without any further customization.
Thx.
package de.eggheads.tools.fluxtest;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.RepeatedTest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import de.eggheads.tools.fluxtest.persistence.DataA;
import de.eggheads.tools.fluxtest.persistence.DataB;
import de.eggheads.tools.fluxtest.repository.DataARepository;
import de.eggheads.tools.fluxtest.repository.DataBRepository;
import de.eggheads.tools.fluxtest.service.DataService;
import lombok.extern.slf4j.Slf4j;
#Slf4j
#SpringBootTest
public class DataServiceTests {
#Autowired
DataARepository dataARepository;
#Autowired
DataBRepository dataBRepository;
#Autowired
DataService dataService;
#BeforeEach
void before() {
dataARepository.deleteAll().block();
for (int i = 0; i < 10000; i++) {
String value = String.valueOf(i);
dataARepository.save(new DataA(value, value)).block();
}
dataBRepository.deleteAll().block();
for (int i = 0; i < 10; i++) {
String value = String.valueOf(i);
dataBRepository.save(new DataB(value, value)).block();
}
}
#RepeatedTest(1)
void findAll() {
for (int i = 0; i < 10; i++) {
int size = dataService.findAll().size();
log.debug("size = {}", size);
assertEquals(10000, size);
}
}
}
package de.eggheads.tools.fluxtest.service;
import java.util.Collection;
import org.springframework.stereotype.Service;
import de.eggheads.tools.fluxtest.persistence.DataA;
import de.eggheads.tools.fluxtest.repository.DataARepository;
import de.eggheads.tools.fluxtest.repository.DataBRepository;
import lombok.RequiredArgsConstructor;
import reactor.core.publisher.Mono;
import reactor.core.scheduler.Schedulers;
#RequiredArgsConstructor
#Service
public class DataService {
private final DataARepository dataARepository;
private final DataBRepository dataBRepository;
private Mono<DataA> map(DataA dataA) {
return Mono.just(dataA).subscribeOn(Schedulers.boundedElastic());
}
public Collection<DataA> findAll() {
return dataARepository.findAll().onErrorContinue((t, o) -> t.printStackTrace()).flatMap(this::map).collectList()
.block();
}
}
package de.eggheads.tools.fluxtest.repository;
import org.springframework.data.mongodb.repository.ReactiveMongoRepository;
import org.springframework.stereotype.Repository;
import de.eggheads.tools.fluxtest.persistence.DataA;
#Repository
public interface DataARepository extends ReactiveMongoRepository<DataA, String> {
}
<properties>
<java.version>11</java.version>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.4</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb-reactive</artifactId>
</dependency>
<dependency>
<groupId>de.flapdoodle.embed</groupId>
<artifactId>de.flapdoodle.embed.mongo</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
22:04:02.279 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating CacheAwareContextLoaderDelegate from class [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate]
22:04:02.293 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating BootstrapContext using constructor [public org.springframework.test.context.support.DefaultBootstrapContext(java.lang.Class,org.springframework.test.context.CacheAwareContextLoaderDelegate)]
22:04:02.327 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating TestContextBootstrapper for test class [de.eggheads.tools.fluxtest.DataServiceTests] from class [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]
22:04:02.343 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Neither #ContextConfiguration nor #ContextHierarchy found for test class [de.eggheads.tools.fluxtest.DataServiceTests], using SpringBootContextLoader
22:04:02.348 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [de.eggheads.tools.fluxtest.DataServiceTests]: class path resource [de/eggheads/tools/fluxtest/DataServiceTests-context.xml] does not exist
22:04:02.348 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [de.eggheads.tools.fluxtest.DataServiceTests]: class path resource [de/eggheads/tools/fluxtest/DataServiceTestsContext.groovy] does not exist
22:04:02.348 [main] INFO org.springframework.test.context.support.AbstractContextLoader - Could not detect default resource locations for test class [de.eggheads.tools.fluxtest.DataServiceTests]: no resource found for suffixes {-context.xml, Context.groovy}.
22:04:02.349 [main] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils - Could not detect default configuration classes for test class [de.eggheads.tools.fluxtest.DataServiceTests]: DataServiceTests does not declare any static, non-private, non-final, nested classes annotated with #Configuration.
22:04:02.393 [main] DEBUG org.springframework.test.context.support.ActiveProfilesUtils - Could not find an 'annotation declaring class' for annotation type [org.springframework.test.context.ActiveProfiles] and class [de.eggheads.tools.fluxtest.DataServiceTests]
22:04:02.458 [main] DEBUG org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider - Identified candidate component class: file [C:\dev\eclipse-2020-12\ws\fluxtest\target\classes\de\eggheads\tools\fluxtest\FluxtestApplication.class]
22:04:02.470 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Found #SpringBootConfiguration de.eggheads.tools.fluxtest.FluxtestApplication for test class de.eggheads.tools.fluxtest.DataServiceTests
22:04:02.571 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - #TestExecutionListeners is not present for class [de.eggheads.tools.fluxtest.DataServiceTests]: using defaults.
22:04:02.572 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener, org.springframework.boot.test.autoconfigure.webservices.client.MockWebServiceServerTestExecutionListener, org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.event.ApplicationEventsTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener, org.springframework.test.context.event.EventPublishingTestExecutionListener]
22:04:02.587 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Skipping candidate TestExecutionListener [org.springframework.test.context.web.ServletTestExecutionListener] due to a missing dependency. Specify custom listener classes or make the default listener classes and their required dependencies available. Offending class: [javax/servlet/ServletContext]
22:04:02.598 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener#2dd80673, org.springframework.test.context.event.ApplicationEventsTestExecutionListener#4af0df05, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener#57ea113a, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener#acdb094, org.springframework.test.context.support.DirtiesContextTestExecutionListener#674bd420, org.springframework.test.context.transaction.TransactionalTestExecutionListener#2b0f373b, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener#2ceb80a1, org.springframework.test.context.event.EventPublishingTestExecutionListener#4b45dcb8, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener#7216fb24, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener#2072acb2, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener#50ecde95, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener#35a9782c, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener#70a36a66, org.springframework.boot.test.autoconfigure.webservices.client.MockWebServiceServerTestExecutionListener#45815ffc]
22:04:02.603 [main] DEBUG org.springframework.test.context.support.AbstractDirtiesContextTestExecutionListener - Before test class: context [DefaultTestContext#5b068087 testClass = DataServiceTests, testInstance = [null], testMethod = [null], testException = [null], mergedContextConfiguration = [ReactiveWebMergedContextConfiguration#6f152006 testClass = DataServiceTests, locations = '{}', classes = '{class de.eggheads.tools.fluxtest.FluxtestApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer#1807f5a7, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer#4dc27487, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer#0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer#1b66c0fb, org.springframework.boot.test.web.reactive.server.WebTestClientContextCustomizer#660acfb, org.springframework.boot.test.autoconfigure.actuate.metrics.MetricsExportContextCustomizerFactory$DisableMetricExportContextCustomizer#2d29b4ee, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer#0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer#3b6d844d, org.springframework.boot.test.context.SpringBootTestArgs#1, org.springframework.boot.test.context.SpringBootTestWebEnvironment#78047b92], contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map[[empty]]], class annotated with #DirtiesContext [false] with mode [null].
22:04:02.628 [main] DEBUG org.springframework.test.context.support.DependencyInjectionTestExecutionListener - Performing dependency injection for test context [[DefaultTestContext#5b068087 testClass = DataServiceTests, testInstance = de.eggheads.tools.fluxtest.DataServiceTests#5ee2b6f9, testMethod = [null], testException = [null], mergedContextConfiguration = [ReactiveWebMergedContextConfiguration#6f152006 testClass = DataServiceTests, locations = '{}', classes = '{class de.eggheads.tools.fluxtest.FluxtestApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer#1807f5a7, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer#4dc27487, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer#0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer#1b66c0fb, org.springframework.boot.test.web.reactive.server.WebTestClientContextCustomizer#660acfb, org.springframework.boot.test.autoconfigure.actuate.metrics.MetricsExportContextCustomizerFactory$DisableMetricExportContextCustomizer#2d29b4ee, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer#0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer#3b6d844d, org.springframework.boot.test.context.SpringBootTestArgs#1, org.springframework.boot.test.context.SpringBootTestWebEnvironment#78047b92], contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map['org.springframework.test.context.event.ApplicationEventsTestExecutionListener.recordApplicationEvents' -> false]]].
22:04:02.662 [main] DEBUG org.springframework.test.context.support.TestPropertySourceUtils - Adding inlined properties to environment: {spring.jmx.enabled=false, org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.4.4)
2021-04-12 22:04:02.963 INFO 18824 --- [ main] d.e.tools.fluxtest.DataServiceTests : Starting DataServiceTests using Java 11.0.9.1 on egg-note58 with PID 18824 (started by christianl in C:\dev\eclipse-2020-12\ws\fluxtest)
2021-04-12 22:04:02.965 INFO 18824 --- [ main] d.e.tools.fluxtest.DataServiceTests : No active profile set, falling back to default profiles: default
2021-04-12 22:04:03.469 INFO 18824 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data Reactive MongoDB repositories in DEFAULT mode.
2021-04-12 22:04:03.655 INFO 18824 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 182 ms. Found 2 Reactive MongoDB repository interfaces.
2021-04-12 22:04:05.646 INFO 18824 --- [ Thread-1] o.s.b.a.mongo.embedded.EmbeddedMongo : note: noprealloc may hurt performance in many applications
2021-04-12 22:04:05.708 INFO 18824 --- [ Thread-1] o.s.b.a.mongo.embedded.EmbeddedMongo : 2021-04-12T22:04:05.708+0200 I CONTROL [initandlisten] MongoDB starting : pid=18632 port=62655 dbpath=C:\Users\CHRIST~1\AppData\Local\Temp\embedmongo-db-2b40d458-5827-4772-ae88-9721f76da138 64-bit host=egg-note58
2021-04-12 22:04:05.708 INFO 18824 --- [ Thread-1] o.s.b.a.mongo.embedded.EmbeddedMongo : 2021-04-12T22:04:05.709+0200 I CONTROL [initandlisten] targetMinOS: Windows Vista/Windows Server 2008
2021-04-12 22:04:05.708 INFO 18824 --- [ Thread-1] o.s.b.a.mongo.embedded.EmbeddedMongo : 2021-04-12T22:04:05.709+0200 I CONTROL [initandlisten] db version v3.5.5
2021-04-12 22:04:05.708 INFO 18824 --- [ Thread-1] o.s.b.a.mongo.embedded.EmbeddedMongo : 2021-04-12T22:04:05.709+0200 I CONTROL [initandlisten] git version: 98515c812b6fa893613f063dae568ff8319cbfbd
2021-04-12 22:04:05.709 INFO 18824 --- [ Thread-1] o.s.b.a.mongo.embedded.EmbeddedMongo : 2021-04-12T22:04:05.709+0200 I CONTROL [initandlisten] allocator: tcmalloc
2021-04-12 22:04:05.709 INFO 18824 --- [ Thread-1] o.s.b.a.mongo.embedded.EmbeddedMongo : 2021-04-12T22:04:05.709+0200 I CONTROL [initandlisten] modules: none
2021-04-12 22:04:05.709 INFO 18824 --- [ Thread-1] o.s.b.a.mongo.embedded.EmbeddedMongo : 2021-04-12T22:04:05.709+0200 I CONTROL [initandlisten] build environment:
2021-04-12 22:04:05.709 INFO 18824 --- [ Thread-1] o.s.b.a.mongo.embedded.EmbeddedMongo : 2021-04-12T22:04:05.709+0200 I CONTROL [initandlisten] distarch: x86_64
2021-04-12 22:04:05.709 INFO 18824 --- [ Thread-1] o.s.b.a.mongo.embedded.EmbeddedMongo : 2021-04-12T22:04:05.709+0200 I CONTROL [initandlisten] target_arch: x86_64
2021-04-12 22:04:05.709 INFO 18824 --- [ Thread-1] o.s.b.a.mongo.embedded.EmbeddedMongo : 2021-04-12T22:04:05.709+0200 I CONTROL [initandlisten] options: { net: { bindIp: "127.0.0.1", http: { enabled: false }, port: 62655 }, security: { authorization: "disabled" }, storage: { dbPath: "C:\Users\CHRIST~1\AppData\Local\Temp\embedmongo-db-2b40d458-5827-4772-ae88-9721f76da138", journal: { enabled: false }, mmapv1: { preallocDataFiles: false, smallFiles: true }, syncPeriodSecs: 0.0 } }
2021-04-12 22:04:05.709 INFO 18824 --- [ Thread-1] o.s.b.a.mongo.embedded.EmbeddedMongo : 2021-04-12T22:04:05.710+0200 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=15766M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=0,log_size=2GB),statistics_log=(wait=0),verbose=(recovery_progress),,log=(enabled=false),
2021-04-12 22:04:05.788 INFO 18824 --- [ Thread-1] o.s.b.a.mongo.embedded.EmbeddedMongo : 2021-04-12T22:04:05.789+0200 W STORAGE [initandlisten] Detected configuration for non-active storage engine mmapv1 when current storage engine is wiredTiger
2021-04-12 22:04:05.788 INFO 18824 --- [ Thread-1] o.s.b.a.mongo.embedded.EmbeddedMongo : 2021-04-12T22:04:05.789+0200 I CONTROL [initandlisten]
2021-04-12 22:04:05.788 INFO 18824 --- [ Thread-1] o.s.b.a.mongo.embedded.EmbeddedMongo : 2021-04-12T22:04:05.789+0200 I CONTROL [initandlisten] ** NOTE: This is a development version (3.5.5) of MongoDB.
2021-04-12 22:04:05.789 INFO 18824 --- [ Thread-1] o.s.b.a.mongo.embedded.EmbeddedMongo : 2021-04-12T22:04:05.789+0200 I CONTROL [initandlisten] ** Not recommended for production.
2021-04-12 22:04:05.789 INFO 18824 --- [ Thread-1] o.s.b.a.mongo.embedded.EmbeddedMongo : 2021-04-12T22:04:05.789+0200 I CONTROL [initandlisten]
2021-04-12 22:04:06.151 INFO 18824 --- [ Thread-1] o.s.b.a.mongo.embedded.EmbeddedMongo : 2021-04-12T22:04:06.152+0200 W FTDC [initandlisten] Failed to initialize Performance Counters for FTDC: WindowsPdhError: PdhExpandCounterPathW failed with 'Das angegebene Objekt wurde nicht auf dem Computer gefunden.' for counter '\Memory\Available Bytes'
2021-04-12 22:04:06.151 INFO 18824 --- [ Thread-1] o.s.b.a.mongo.embedded.EmbeddedMongo : 2021-04-12T22:04:06.152+0200 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory 'C:/Users/CHRIST~1/AppData/Local/Temp/embedmongo-db-2b40d458-5827-4772-ae88-9721f76da138/diagnostic.data'
2021-04-12 22:04:06.187 INFO 18824 --- [ Thread-1] o.s.b.a.mongo.embedded.EmbeddedMongo : 2021-04-12T22:04:06.188+0200 I INDEX [initandlisten] build index on: admin.system.version properties: { v: 2, key: { version: 1 }, name: "incompatible_with_version_32", ns: "admin.system.version" }
2021-04-12 22:04:06.187 INFO 18824 --- [ Thread-1] o.s.b.a.mongo.embedded.EmbeddedMongo : 2021-04-12T22:04:06.188+0200 I INDEX [initandlisten] building index using bulk method; build may temporarily use up to 500 megabytes of RAM
2021-04-12 22:04:06.189 INFO 18824 --- [ Thread-1] o.s.b.a.mongo.embedded.EmbeddedMongo : 2021-04-12T22:04:06.190+0200 I INDEX [initandlisten] build index done. scanned 0 total records. 0 secs
2021-04-12 22:04:06.190 INFO 18824 --- [ Thread-1] o.s.b.a.mongo.embedded.EmbeddedMongo : 2021-04-12T22:04:06.191+0200 I COMMAND [initandlisten] setting featureCompatibilityVersion to 3.4
2021-04-12 22:04:06.191 INFO 18824 --- [ Thread-1] o.s.b.a.mongo.embedded.EmbeddedMongo : 2021-04-12T22:04:06.192+0200 I NETWORK [thread1] waiting for connections on port 62655
2021-04-12 22:04:06.191 INFO 18824 --- [ main] d.f.embed.mongo.MongodExecutable : start de.flapdoodle.embed.mongo.config.MongodConfigBuilder$ImmutableMongodConfig#16a9eb2e
2021-04-12 22:04:06.439 INFO 18824 --- [ main] org.mongodb.driver.cluster : Cluster created with settings {hosts=[localhost:62655], mode=SINGLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms'}
2021-04-12 22:04:07.344 INFO 18824 --- [ main] d.e.tools.fluxtest.DataServiceTests : Started DataServiceTests in 4.669 seconds (JVM running for 5.804)
2021-04-12 22:04:07.378 INFO 18824 --- [ Thread-1] o.s.b.a.mongo.embedded.EmbeddedMongo : 2021-04-12T22:04:07.378+0200 I NETWORK [thread1] connection accepted from 127.0.0.1:62710 #1 (1 connection now open)
2021-04-12 22:04:07.378 INFO 18824 --- [ Thread-1] o.s.b.a.mongo.embedded.EmbeddedMongo : 2021-04-12T22:04:07.378+0200 I NETWORK [thread1] connection accepted from 127.0.0.1:62711 #2 (2 connections now open)
2021-04-12 22:04:07.423 INFO 18824 --- [ Thread-1] o.s.b.a.mongo.embedded.EmbeddedMongo : 2021-04-12T22:04:07.423+0200 I NETWORK [conn2] received client metadata from 127.0.0.1:62711 conn2: { driver: { name: "mongo-java-driver|reactive-streams|spring-boot", version: "4.1.2" }, os: { type: "Windows", name: "Windows 10", architecture: "amd64", version: "10.0" }, platform: "Java/AdoptOpenJDK/11.0.9.1+1" }
2021-04-12 22:04:07.423 INFO 18824 --- [ Thread-1] o.s.b.a.mongo.embedded.EmbeddedMongo : 2021-04-12T22:04:07.423+0200 I NETWORK [conn1] received client metadata from 127.0.0.1:62710 conn1: { driver: { name: "mongo-java-driver|reactive-streams|spring-boot", version: "4.1.2" }, os: { type: "Windows", name: "Windows 10", architecture: "amd64", version: "10.0" }, platform: "Java/AdoptOpenJDK/11.0.9.1+1" }
2021-04-12 22:04:07.450 INFO 18824 --- [localhost:62655] org.mongodb.driver.connection : Opened connection [connectionId{localValue:2, serverValue:2}] to localhost:62655
2021-04-12 22:04:07.450 INFO 18824 --- [localhost:62655] org.mongodb.driver.connection : Opened connection [connectionId{localValue:1, serverValue:1}] to localhost:62655
2021-04-12 22:04:07.451 INFO 18824 --- [localhost:62655] org.mongodb.driver.cluster : Monitor thread successfully connected to server with description ServerDescription{address=localhost:62655, type=STANDALONE, state=CONNECTED, ok=true, minWireVersion=0, maxWireVersion=5, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=null, roundTripTimeNanos=65840300}
2021-04-12 22:04:07.903 INFO 18824 --- [ Thread-1] o.s.b.a.mongo.embedded.EmbeddedMongo : 2021-04-12T22:04:07.903+0200 I NETWORK [thread1] connection accepted from 127.0.0.1:62713 #3 (3 connections now open)
2021-04-12 22:04:07.909 INFO 18824 --- [ Thread-1] o.s.b.a.mongo.embedded.EmbeddedMongo : 2021-04-12T22:04:07.909+0200 I NETWORK [conn3] received client metadata from 127.0.0.1:62713 conn3: { driver: { name: "mongo-java-driver|reactive-streams|spring-boot", version: "4.1.2" }, os: { type: "Windows", name: "Windows 10", architecture: "amd64", version: "10.0" }, platform: "Java/AdoptOpenJDK/11.0.9.1+1" }
2021-04-12 22:04:07.912 INFO 18824 --- [ntLoopGroup-2-3] org.mongodb.driver.connection : Opened connection [connectionId{localValue:3, serverValue:3}] to localhost:62655
2021-04-12 22:04:14.110 INFO 18824 --- [extShutdownHook] org.mongodb.driver.connection : Closed connection [connectionId{localValue:3, serverValue:3}] to localhost:62655 because the pool has been closed.
2021-04-12 22:04:14.112 INFO 18824 --- [ Thread-1] o.s.b.a.mongo.embedded.EmbeddedMongo : 2021-04-12T22:04:14.113+0200 I - [conn3] end connection 127.0.0.1:62713 (3 connections now open)
2021-04-12 22:04:14.113 INFO 18824 --- [ Thread-1] o.s.b.a.mongo.embedded.EmbeddedMongo : 2021-04-12T22:04:14.113+0200 I - [conn1] end connection 127.0.0.1:62710 (2 connections now open)
2021-04-12 22:04:14.113 INFO 18824 --- [ Thread-1] o.s.b.a.mongo.embedded.EmbeddedMongo : 2021-04-12T22:04:14.113+0200 I - [conn2] end connection 127.0.0.1:62711 (1 connection now open)
2021-04-12 22:04:16.206 INFO 18824 --- [ Thread-1] o.s.b.a.mongo.embedded.EmbeddedMongo : 2021-04-12T22:04:16.206+0200 I NETWORK [thread1] connection accepted from 127.0.0.1:62715 #4 (1 connection now open)
2021-04-12 22:04:16.206 INFO 18824 --- [ Thread-1] o.s.b.a.mongo.embedded.EmbeddedMongo : 2021-04-12T22:04:16.206+0200 I COMMAND [conn4] terminating, shutdown command received
2021-04-12 22:04:16.206 INFO 18824 --- [ Thread-1] o.s.b.a.mongo.embedded.EmbeddedMongo : 2021-04-12T22:04:16.206+0200 I NETWORK [conn4] shutdown: going to close listening sockets...
2021-04-12 22:04:16.206 INFO 18824 --- [ Thread-1] o.s.b.a.mongo.embedded.EmbeddedMongo : 2021-04-12T22:04:16.206+0200 I NETWORK [conn4] closing listening socket: 540
2021-04-12 22:04:16.206 INFO 18824 --- [ Thread-1] o.s.b.a.mongo.embedded.EmbeddedMongo : 2021-04-12T22:04:16.206+0200 I NETWORK [conn4] shutdown: going to flush diaglog...
2021-04-12 22:04:16.206 INFO 18824 --- [ Thread-1] o.s.b.a.mongo.embedded.EmbeddedMongo : 2021-04-12T22:04:16.206+0200 I FTDC [conn4] Shutting down full-time diagnostic data capture
2021-04-12 22:04:16.212 INFO 18824 --- [ Thread-1] o.s.b.a.mongo.embedded.EmbeddedMongo : 2021-04-12T22:04:16.212+0200 I STORAGE [conn4] WiredTigerKVEngine shutting down
2021-04-12 22:04:16.307 INFO 18824 --- [ Thread-1] o.s.b.a.mongo.embedded.EmbeddedMongo : 2021-04-12T22:04:16.307+0200 I STORAGE [conn4] shutdown: removing fs lock...
2021-04-12 22:04:16.308 INFO 18824 --- [ Thread-1] o.s.b.a.mongo.embedded.EmbeddedMongo : 2021-04-12T22:04:16.307+0200 I CONTROL [conn4] now exiting
2021-04-12 22:04:16.308 INFO 18824 --- [ Thread-1] o.s.b.a.mongo.embedded.EmbeddedMongo : 2021-04-12T22:04:16.307+0200 I CONTROL [conn4] shutting down with code:0
Related
I can't figure out why my dockerized Spring Boot application terminates immediately after starting up. I looked into similar issues but couldn't find a reason for mine to fail yet.
The docker image runs ok locally, but when running on Azure Container Apps it does an auto-shutdown.
This is the log with Hikari on debug:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.7.4)
2022-10-02 23:09:00.444 INFO 1 --- [ main] io.pomatti.app.books.BookApplication : Starting BookApplication v0.0.1-SNAPSHOT using Java 17.0.4.1 on app-books--sw6babs-6db8f449fb-n2pvt with PID 1 (/opt/app/*.jar started by root in /opt/app)
2022-10-02 23:09:00.509 INFO 1 --- [ main] io.pomatti.app.books.BookApplication : No active profile set, falling back to 1 default profile: "default"
2022-10-02 23:09:02.933 INFO 1 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2022-10-02 23:09:03.111 INFO 1 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 169 ms. Found 1 JPA repository interfaces.
2022-10-02 23:09:04.535 INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2022-10-02 23:09:04.542 INFO 1 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2022-10-02 23:09:04.542 INFO 1 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.65]
2022-10-02 23:09:04.715 INFO 1 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2022-10-02 23:09:04.715 INFO 1 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 4080 ms
2022-10-02 23:09:04.927 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : Driver class com.microsoft.sqlserver.jdbc.SQLServerDriver found in Thread context class loader TomcatEmbeddedWebappClassLoader
context: ROOT
delegate: true
----------> Parent Classloader:
org.springframework.boot.loader.LaunchedURLClassLoader#28c97a5
2022-10-02 23:09:05.833 INFO 1 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2022-10-02 23:09:06.014 INFO 1 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.6.11.Final
2022-10-02 23:09:06.327 INFO 1 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
2022-10-02 23:09:06.617 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : HikariPool-1 - configuration:
2022-10-02 23:09:06.620 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : allowPoolSuspension................................false
2022-10-02 23:09:06.620 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : autoCommit................................true
2022-10-02 23:09:06.620 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : catalog................................none
2022-10-02 23:09:06.620 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : connectionInitSql................................none
2022-10-02 23:09:06.620 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : connectionTestQuery................................none
2022-10-02 23:09:06.620 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : connectionTimeout................................30000
2022-10-02 23:09:06.620 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : dataSource................................none
2022-10-02 23:09:06.621 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : dataSourceClassName................................none
2022-10-02 23:09:06.621 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : dataSourceJNDI................................none
2022-10-02 23:09:06.621 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : dataSourceProperties................................{password=<masked>}
2022-10-02 23:09:06.621 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : driverClassName................................"com.microsoft.sqlserver.jdbc.SQLServerDriver"
2022-10-02 23:09:06.621 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : exceptionOverrideClassName................................none
2022-10-02 23:09:06.621 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : healthCheckProperties................................{}
2022-10-02 23:09:06.622 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : healthCheckRegistry................................none
2022-10-02 23:09:06.622 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : idleTimeout................................600000
2022-10-02 23:09:06.622 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : initializationFailTimeout................................1
2022-10-02 23:09:06.622 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : isolateInternalQueries................................false
2022-10-02 23:09:06.622 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : jdbcUrl................................jdbc:sqlserver://sql-autoscale-2996.database.windows.net:1433;database=sqldb-autoscale-2996;user=dbadmin#sql-autoscale-2996;password=<masked>#777;encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;loginTimeout=30;
2022-10-02 23:09:06.622 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : keepaliveTime................................0
2022-10-02 23:09:06.622 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : leakDetectionThreshold................................0
2022-10-02 23:09:06.623 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : maxLifetime................................1800000
2022-10-02 23:09:06.623 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : maximumPoolSize................................10
2022-10-02 23:09:06.623 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : metricRegistry................................none
2022-10-02 23:09:06.623 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : metricsTrackerFactory................................com.zaxxer.hikari.metrics.micrometer.MicrometerMetricsTrackerFactory#5e8a459
2022-10-02 23:09:06.623 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : minimumIdle................................10
2022-10-02 23:09:06.623 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : password................................<masked>
2022-10-02 23:09:06.623 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : poolName................................"HikariPool-1"
2022-10-02 23:09:06.623 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : readOnly................................false
2022-10-02 23:09:06.623 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : registerMbeans................................false
2022-10-02 23:09:06.624 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : scheduledExecutor................................none
2022-10-02 23:09:06.624 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : schema................................none
2022-10-02 23:09:06.624 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : threadFactory................................internal
2022-10-02 23:09:06.624 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : transactionIsolation................................default
2022-10-02 23:09:06.624 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : username................................none
2022-10-02 23:09:06.624 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : validationTimeout................................5000
2022-10-02 23:09:06.624 INFO 1 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2022-10-02 23:09:07.726 DEBUG 1 --- [ main] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Added connection ConnectionID:1 ClientConnectionId: 1061c2f8-febf-4f1f-b9f6-86ee6dd22af4
2022-10-02 23:09:07.732 INFO 1 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2022-10-02 23:09:07.824 INFO 1 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.SQLServer2012Dialect
2022-10-02 23:09:07.832 DEBUG 1 --- [l-1 housekeeper] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Pool stats (total=1, active=1, idle=0, waiting=0)
2022-10-02 23:09:08.027 DEBUG 1 --- [onnection adder] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Added connection ConnectionID:2 ClientConnectionId: 5035df48-1a77-406f-95b1-99d289e2d70e
2022-10-02 23:09:08.227 DEBUG 1 --- [onnection adder] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Added connection ConnectionID:3 ClientConnectionId: 2f01f8bb-e542-4351-9b5c-dcf7cd6084ef
2022-10-02 23:09:08.411 DEBUG 1 --- [onnection adder] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Added connection ConnectionID:4 ClientConnectionId: fd8950e7-85e8-4ae2-80be-8d88d3a7c84d
2022-10-02 23:09:08.614 DEBUG 1 --- [onnection adder] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Added connection ConnectionID:5 ClientConnectionId: 73205252-2e69-4a7d-b347-9ba7d8e6458f
2022-10-02 23:09:08.737 DEBUG 1 --- [onnection adder] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Added connection ConnectionID:6 ClientConnectionId: 0814ccbd-f55c-4442-925d-be9046619eb5
2022-10-02 23:09:08.921 DEBUG 1 --- [onnection adder] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Added connection ConnectionID:7 ClientConnectionId: f5fb5f48-1c99-4b0c-9b58-828627cfaac2
2022-10-02 23:09:09.119 DEBUG 1 --- [onnection adder] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Added connection ConnectionID:8 ClientConnectionId: 730e1bf3-1e7b-4416-980e-9a64cda711ea
2022-10-02 23:09:09.319 DEBUG 1 --- [onnection adder] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Added connection ConnectionID:9 ClientConnectionId: 23786119-d561-4da6-a59e-08ceb76c7065
2022-10-02 23:09:09.519 DEBUG 1 --- [onnection adder] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Added connection ConnectionID:10 ClientConnectionId: 9cc6c870-b6a2-4ee3-bc06-14d81bd03471
2022-10-02 23:09:09.519 DEBUG 1 --- [onnection adder] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - After adding stats (total=10, active=0, idle=10, waiting=0)
2022-10-02 23:09:09.826 INFO 1 --- [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2022-10-02 23:09:09.832 INFO 1 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2022-10-02 23:09:10.419 WARN 1 --- [ 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-10-02 23:09:11.224 INFO 1 --- [ main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 1 endpoint(s) beneath base path '/actuator'
2022-10-02 23:09:11.314 INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2022-10-02 23:09:11.325 INFO 1 --- [ main] io.pomatti.app.books.BookApplication : Started BookApplication in 11.913 seconds (JVM running for 12.911)
2022-10-02 23:09:11.412 INFO 1 --- [ionShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2022-10-02 23:09:11.415 INFO 1 --- [ionShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
2022-10-02 23:09:11.415 DEBUG 1 --- [ionShutdownHook] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Before shutdown stats (total=10, active=0, idle=10, waiting=0)
2022-10-02 23:09:11.416 DEBUG 1 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Closing connection ConnectionID:1 ClientConnectionId: 1061c2f8-febf-4f1f-b9f6-86ee6dd22af4: (connection evicted)
2022-10-02 23:09:11.416 DEBUG 1 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Closing connection ConnectionID:2 ClientConnectionId: 5035df48-1a77-406f-95b1-99d289e2d70e: (connection evicted)
2022-10-02 23:09:11.417 DEBUG 1 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Closing connection ConnectionID:3 ClientConnectionId: 2f01f8bb-e542-4351-9b5c-dcf7cd6084ef: (connection evicted)
2022-10-02 23:09:11.417 DEBUG 1 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Closing connection ConnectionID:4 ClientConnectionId: fd8950e7-85e8-4ae2-80be-8d88d3a7c84d: (connection evicted)
2022-10-02 23:09:11.418 DEBUG 1 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Closing connection ConnectionID:5 ClientConnectionId: 73205252-2e69-4a7d-b347-9ba7d8e6458f: (connection evicted)
2022-10-02 23:09:11.418 DEBUG 1 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Closing connection ConnectionID:6 ClientConnectionId: 0814ccbd-f55c-4442-925d-be9046619eb5: (connection evicted)
2022-10-02 23:09:11.419 DEBUG 1 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Closing connection ConnectionID:7 ClientConnectionId: f5fb5f48-1c99-4b0c-9b58-828627cfaac2: (connection evicted)
2022-10-02 23:09:11.419 DEBUG 1 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Closing connection ConnectionID:8 ClientConnectionId: 730e1bf3-1e7b-4416-980e-9a64cda711ea: (connection evicted)
2022-10-02 23:09:11.420 DEBUG 1 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Closing connection ConnectionID:9 ClientConnectionId: 23786119-d561-4da6-a59e-08ceb76c7065: (connection evicted)
2022-10-02 23:09:11.420 DEBUG 1 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Closing connection ConnectionID:10 ClientConnectionId: 9cc6c870-b6a2-4ee3-bc06-14d81bd03471: (connection evicted)
2022-10-02 23:09:11.421 DEBUG 1 --- [ionShutdownHook] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - After shutdown stats (total=0, active=0, idle=0, waiting=0)
2022-10-02 23:09:11.421 INFO 1 --- [ionShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
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.7.4</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>io.pomatti.app</groupId>
<artifactId>order</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>order</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>17</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- Spring -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</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-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>11.2.1.jre17</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.24</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Main class:
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
#SpringBootApplication
#RestController
#RequestMapping("/api/books")
public class BookApplication {
public static void main(String[] args) {
SpringApplication.run(BookApplication.class, args);
}
#Autowired
BookRepository repository;
#PostMapping("/")
public Book post(#RequestBody Book order) {
var book = new Book();
book.setName("Eternal Sunshine");
book.setAuthor("Anonymous");
return repository.save(book);
}
}
Dockerfile:
# syntax=docker/dockerfile:1
FROM eclipse-temurin:17-jdk-jammy as builder
WORKDIR /opt/app
COPY .mvn/ .mvn
COPY mvnw pom.xml ./
RUN ./mvnw dependency:go-offline
COPY ./src ./src
RUN ./mvnw clean install
FROM eclipse-temurin:17-jre-jammy
WORKDIR /opt/app
EXPOSE 8080
COPY --from=builder /opt/app/target/*.jar /opt/app/*.jar
ENTRYPOINT ["java", "-jar", "/opt/app/*.jar" ]
Pods were being restarted due to a too short initial delay for the health probe, which I had set for 3s. I've increased it to 10s and it solved the issue.
probes = [
{
type = "Liveness"
httpGet = {
path = "/actuator/health"
port = var.ingress_target_port
httpHeaders = [
{
name = "Custom-Header"
value = "Awesome"
}
]
}
initialDelaySeconds = 10
periodSeconds = 5
}
]
I've found that out by looking into the System Logs available for each container.
Everything runs totally fine when I get the images up and running in docker. I normally build with mvn spring-boot:build-image -DskipTests, I used the dskiptests so I don't have to see the errors.
How do I actually do it the right way? (Or the way that doesn't include skipping tests) Is it that because I don't have my own tests specified it does some generic test that fails because it can't reach the naming server? Do I need to run the naming server before I build the service? (That can't be right) Any guidance would be helpful.
Here's the test output. I truncated at the first eureka error because the rest of the errors are just that over and over again. Thanks for any help!
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running myproject.apigateway.ApiGatewayApplicationTests
13:13:51.533 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating CacheAwareContextLoaderDelegate from class [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate]
13:13:51.543 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating BootstrapContext using constructor [public org.springframework.test.context.support.DefaultBootstrapContext(java.lang.Class,org.springframework.test.context.CacheAwareContextLoaderDelegate)]
13:13:51.573 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating TestContextBootstrapper for test class [myproject.apigateway.ApiGatewayApplicationTests] from class [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]
13:13:51.582 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Neither #ContextConfiguration nor #ContextHierarchy found for test class [myproject.apigateway.ApiGatewayApplicationTests], using SpringBootContextLoader
13:13:51.585 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [myproject.apigateway.ApiGatewayApplicationTests]: class path resource [myproject/apigateway/ApiGatewayApplicationTests-context.xml] does not exist
13:13:51.586 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [myproject.apigateway.ApiGatewayApplicationTests]: class path resource [myproject/apigateway/ApiGatewayApplicationTestsContext.groovy] does not exist
13:13:51.586 [main] INFO org.springframework.test.context.support.AbstractContextLoader - Could not detect default resource locations for test class [myproject.apigateway.ApiGatewayApplicationTests]: no resource found for suffixes {-context.xml, Context.groovy}.
13:13:51.586 [main] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils - Could not detect default configuration classes for test class [myproject.apigateway.ApiGatewayApplicationTests]: ApiGatewayApplicationTests does not declare any static, non-private, non-final, nested classes annotated with #Configuration.
13:13:51.626 [main] DEBUG org.springframework.test.context.support.ActiveProfilesUtils - Could not find an 'annotation declaring class' for annotation type [org.springframework.test.context.ActiveProfiles] and class [myproject.apigateway.ApiGatewayApplicationTests]
13:13:51.673 [main] DEBUG org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider - Identified candidate component class: file [Microservices\api-gateway\target\classes\myproject\apigateway\ApiGatewayApplication.class]
13:13:51.676 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Found #SpringBootConfiguration myproject.apigateway.ApiGatewayApplication for test class myproject.apigateway.ApiGatewayApplicationTests
13:13:51.780 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - #TestExecutionListeners is not present for class [myproject.apigateway.ApiGatewayApplicationTests]: using defaults.
13:13:51.780 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener, org.springframework.boot.test.autoconfigure.webservices.client.MockWebServiceServerTestExecutionListener, org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.event.ApplicationEventsTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener, org.springframework.test.context.event.EventPublishingTestExecutionListener]
13:13:51.788 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Skipping candidate TestExecutionListener [org.springframework.test.context.web.ServletTestExecutionListener] due to a missing dependency. Specify custom listener classes or make the default listener classes and their required dependencies available. Offending class: [javax/servlet/ServletContext]
13:13:51.790 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Skipping candidate TestExecutionListener [org.springframework.test.context.transaction.TransactionalTestExecutionListener] due to a missing dependency. Specify custom listener classes or make the default listener classes and their required dependencies available. Offending class: [org/springframework/transaction/interceptor/TransactionAttributeSource]
13:13:51.791 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Skipping candidate TestExecutionListener [org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener] due to a missing dependency. Specify custom listener classes or make the default listener classes and their required dependencies available. Offending class: [org/springframework/transaction/interceptor/TransactionAttribute]
13:13:51.791 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener#72758afa, org.springframework.test.context.event.ApplicationEventsTestExecutionListener#fb9c7aa, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener#4c398c80, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener#7fc6de5b, org.springframework.test.context.support.DirtiesContextTestExecutionListener#21baa903, org.springframework.test.context.event.EventPublishingTestExecutionListener#607fbe09, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener#60a2630a, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener#29df4d43, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener#5dd91bca, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener#40cb698e, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener#3382f8ae, org.springframework.boot.test.autoconfigure.webservices.client.MockWebServiceServerTestExecutionListener#60641ec8]
13:13:51.795 [main] DEBUG org.springframework.test.context.support.AbstractDirtiesContextTestExecutionListener - Before test class: context [DefaultTestContext#207b8649 testClass = ApiGatewayApplicationTests, testInstance = [null], testMethod = [null], testException = [null], mergedContextConfiguration = [ReactiveWebMergedContextConfiguration#65b3a85a testClass = ApiGatewayApplicationTests, locations = '{}', classes = '{class myproject.apigateway.ApiGatewayApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer#51a9ad5e, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer#239105a8, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer#0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer#2e32ccc5, org.springframework.boot.test.web.reactive.server.WebTestClientContextCustomizer#4dd6fd0a, org.springframework.boot.test.autoconfigure.actuate.metrics.MetricsExportContextCustomizerFactory$DisableMetricExportContextCustomizer#4a00d9cf, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer#0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer#766653e6, org.springframework.boot.test.context.SpringBootTestArgs#1, org.springframework.boot.test.context.SpringBootTestWebEnvironment#7fa98a66], contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map[[empty]]], class annotated with #DirtiesContext [false] with mode [null].
13:13:51.807 [main] DEBUG org.springframework.test.context.support.DependencyInjectionTestExecutionListener - Performing dependency injection for test context [[DefaultTestContext#207b8649 testClass = ApiGatewayApplicationTests, testInstance = myproject.apigateway.ApiGatewayApplicationTests#a8e6492, testMethod = [null], testException = [null], mergedContextConfiguration = [ReactiveWebMergedContextConfiguration#65b3a85a testClass = ApiGatewayApplicationTests, locations = '{}', classes = '{class myproject.apigateway.ApiGatewayApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer#51a9ad5e, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer#239105a8, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer#0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer#2e32ccc5, org.springframework.boot.test.web.reactive.server.WebTestClientContextCustomizer#4dd6fd0a, org.springframework.boot.test.autoconfigure.actuate.metrics.MetricsExportContextCustomizerFactory$DisableMetricExportContextCustomizer#4a00d9cf, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer#0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer#766653e6, org.springframework.boot.test.context.SpringBootTestArgs#1, org.springframework.boot.test.context.SpringBootTestWebEnvironment#7fa98a66], contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map['org.springframework.test.context.event.ApplicationEventsTestExecutionListener.recordApplicationEvents' -> false]]].
13:13:51.830 [main] DEBUG org.springframework.test.context.support.TestPropertySourceUtils - Adding inlined properties to environment: {spring.jmx.enabled=false, org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.4.4)
2021-10-21 13:13:52.582 INFO 13388 --- [ main] m.n.n.e.a.ApiGatewayApplicationTests : Starting ApiGatewayApplicationTests using Java 11.0.8 on COMPUTER with PID 13388 (started by user in Microservices\api-gateway)
2021-10-21 13:13:52.583 INFO 13388 --- [ main] m.n.n.e.a.ApiGatewayApplicationTests : No active profile set, falling back to default profiles: default
2021-10-21 13:13:53.333 INFO 13388 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=b3d64ecf-1689-39e9-a774-4aeb91dfd40a
2021-10-21 13:13:53.400 INFO 13388 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.client.loadbalancer.reactive.LoadBalancerBeanPostProcessorAutoConfiguration' of type [org.springframework.cloud.client.loadbalancer.reactive.LoadBalancerBeanPostProcessorAutoConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-10-21 13:13:53.402 INFO 13388 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.client.loadbalancer.reactive.LoadBalancerBeanPostProcessorAutoConfiguration$ReactorDeferringLoadBalancerFilterConfig' of type [org.springframework.cloud.client.loadbalancer.reactive.LoadBalancerBeanPostProcessorAutoConfiguration$ReactorDeferringLoadBalancerFilterConfig] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-10-21 13:13:53.407 INFO 13388 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'reactorDeferringLoadBalancerExchangeFilterFunction' of type [org.springframework.cloud.client.loadbalancer.reactive.DeferringLoadBalancerExchangeFilterFunction] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-10-21 13:13:55.191 INFO 13388 --- [ main] o.s.c.g.r.RouteDefinitionRouteLocator : Loaded RoutePredicateFactory [After]
2021-10-21 13:13:55.192 INFO 13388 --- [ main] o.s.c.g.r.RouteDefinitionRouteLocator : Loaded RoutePredicateFactory [Before]
2021-10-21 13:13:55.192 INFO 13388 --- [ main] o.s.c.g.r.RouteDefinitionRouteLocator : Loaded RoutePredicateFactory [Between]
2021-10-21 13:13:55.192 INFO 13388 --- [ main] o.s.c.g.r.RouteDefinitionRouteLocator : Loaded RoutePredicateFactory [Cookie]
2021-10-21 13:13:55.192 INFO 13388 --- [ main] o.s.c.g.r.RouteDefinitionRouteLocator : Loaded RoutePredicateFactory [Header]
2021-10-21 13:13:55.192 INFO 13388 --- [ main] o.s.c.g.r.RouteDefinitionRouteLocator : Loaded RoutePredicateFactory [Host]
2021-10-21 13:13:55.192 INFO 13388 --- [ main] o.s.c.g.r.RouteDefinitionRouteLocator : Loaded RoutePredicateFactory [Method]
2021-10-21 13:13:55.192 INFO 13388 --- [ main] o.s.c.g.r.RouteDefinitionRouteLocator : Loaded RoutePredicateFactory [Path]
2021-10-21 13:13:55.192 INFO 13388 --- [ main] o.s.c.g.r.RouteDefinitionRouteLocator : Loaded RoutePredicateFactory [Query]
2021-10-21 13:13:55.192 INFO 13388 --- [ main] o.s.c.g.r.RouteDefinitionRouteLocator : Loaded RoutePredicateFactory [ReadBody]
2021-10-21 13:13:55.192 INFO 13388 --- [ main] o.s.c.g.r.RouteDefinitionRouteLocator : Loaded RoutePredicateFactory [RemoteAddr]
2021-10-21 13:13:55.192 INFO 13388 --- [ main] o.s.c.g.r.RouteDefinitionRouteLocator : Loaded RoutePredicateFactory [Weight]
2021-10-21 13:13:55.193 INFO 13388 --- [ main] o.s.c.g.r.RouteDefinitionRouteLocator : Loaded RoutePredicateFactory [CloudFoundryRouteService]
2021-10-21 13:13:55.511 INFO 13388 --- [ main] DiscoveryClientOptionalArgsConfiguration : Eureka HTTP Client uses RestTemplate.
2021-10-21 13:13:56.648 WARN 13388 --- [ main] iguration$LoadBalancerCaffeineWarnLogger : Spring Cloud LoadBalancer is currently working with the default cache. You can switch to using Caffeine cache, by adding it and org.springframework.cache.caffeine.CaffeineCacheManager to the classpath.
2021-10-21 13:13:56.670 INFO 13388 --- [ main] o.s.c.n.eureka.InstanceInfoFactory : Setting initial instance status as: STARTING
2021-10-21 13:13:56.771 INFO 13388 --- [ main] com.netflix.discovery.DiscoveryClient : Initializing Eureka in region us-east-1
2021-10-21 13:13:56.777 INFO 13388 --- [ main] c.n.d.s.r.aws.ConfigClusterResolver : Resolving eureka endpoints via configuration
2021-10-21 13:13:57.120 INFO 13388 --- [ main] com.netflix.discovery.DiscoveryClient : Disable delta property : false
2021-10-21 13:13:57.120 INFO 13388 --- [ main] com.netflix.discovery.DiscoveryClient : Single vip registry refresh property : null
2021-10-21 13:13:57.120 INFO 13388 --- [ main] com.netflix.discovery.DiscoveryClient : Force full registry fetch : false
2021-10-21 13:13:57.120 INFO 13388 --- [ main] com.netflix.discovery.DiscoveryClient : Application is null : false
2021-10-21 13:13:57.120 INFO 13388 --- [ main] com.netflix.discovery.DiscoveryClient : Registered Applications size is zero : true
2021-10-21 13:13:57.120 INFO 13388 --- [ main] com.netflix.discovery.DiscoveryClient : Application version is -1: true
2021-10-21 13:13:57.120 INFO 13388 --- [ main] com.netflix.discovery.DiscoveryClient : Getting all instance registry info from the eureka server
2021-10-21 13:14:01.493 INFO 13388 --- [ main] c.n.d.s.t.d.RedirectingEurekaHttpClient : Request execution error. endpoint=DefaultEndpoint{ serviceUrl='http://localhost:8761/eureka/}, exception=I/O error on GET request for "http://localhost:8761/eureka/apps/": Connect to localhost:8761 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect; nested exception is org.apache.http.conn.HttpHostConnectException: Connect to localhost:8761 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect stacktrace=org.springframework.web.client.ResourceAccessException: I/O error on GET request for "http://localhost:8761/eureka/apps/": Connect to localhost:8761 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect; nested exception is org.apache.http.conn.HttpHostConnectException: Connect to localhost:8761 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect
I don't understand why my spring boot app takes 15 seconds to start when I run it in regular mode vs 15 minutes when I run it in debug mode.
Debug mode Logs:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.1.3.RELEASE)
2020-02-28 16:57:27.214 INFO [my-project,,,] 5740 --- [ restartedMain] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at : https://config-server.my-company.org
2020-02-28 16:57:29.442 INFO [my-project,,,] 5740 --- [ restartedMain] c.c.c.ConfigServicePropertySourceLocator : Located environment: name=my-project, profiles=[dev], label=null, version=c656a6ca556f4fc58135e673a7e5c4e97a2e5088, state=null
2020-02-28 16:57:33.537 INFO [my-project,,,] 5740 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2020-02-28 16:57:33.537 INFO [my-project,,,] 5740 --- [ restartedMain] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 4023 ms
2020-02-28 16:57:37.986 INFO [my-project,,,] 5740 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2020-02-28 17:00:22.158 INFO [my-project,,,] 5740 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
2020-02-28 17:02:21.271 WARN [my-project,,,] 5740 --- [ restartedMain] aWebConfiguration$JpaWebMvcConfiguration : 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
2020-02-28 17:03:37.441 INFO [my-project,,,] 5740 --- [ restartedMain] o.s.b.a.e.web.EndpointLinksResolver : Exposing 16 endpoint(s) beneath base path '/actuator'
2020-02-28 17:04:22.272 INFO [my-project,,,] 5740 --- [ restartedMain] pertySourcedRequestMappingHandlerMapping : Mapped URL path [/v2/api-docs] onto method [public org.springframework.http.ResponseEntity<springfox.documentation.spring.web.json.Json> springfox.documentation.swagger2.web.Swagger2Controller.getDocumentation(java.lang.String,javax.servlet.http.HttpServletRequest)]
2020-02-28 17:04:58.404 WARN [my-project,,,] 5740 --- [ restartedMain] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources.
2020-02-28 17:04:58.416 INFO [my-project,,,] 5740 --- [ restartedMain] c.n.c.sources.URLConfigurationSource : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2020-02-28 17:04:58.753 WARN [my-project,,,] 5740 --- [ restartedMain] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources.
2020-02-28 17:04:58.765 INFO [my-project,,,] 5740 --- [ restartedMain] c.n.c.sources.URLConfigurationSource : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2020-02-28 17:05:58.718 INFO [my-project,,,] 5740 --- [ restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2020-02-28 17:07:05.596 INFO [my-project,,,] 5740 --- [ restartedMain] o.e.s.filters.AnnotationSizeOfFilter : Using regular expression provided through VM argument org.ehcache.sizeof.filters.AnnotationSizeOfFilter.pattern for IgnoreSizeOf annotation : ^.*cache\..*IgnoreSizeOf$
2020-02-28 17:07:29.728 INFO [my-project,,,] 5740 --- [ restartedMain] c.my-company.security.idp.BeanFactory : override default IdpOAuthManager userInfoCallDisabled = true, IdpUser will only contains uid
2020-02-28 17:08:24.056 INFO [my-project,,,] 5740 --- [ restartedMain] o.s.s.c.ThreadPoolTaskScheduler : Initializing ExecutorService
2020-02-28 17:09:58.919 INFO [my-project,,,] 5740 --- [ restartedMain] o.s.s.web.DefaultSecurityFilterChain : Creating filter chain: any request org.springframework.web.filter.CorsFilter#7430bc1e,
2020-02-28 17:12:03.101 INFO [my-project,,,] 5740 --- [ restartedMain] d.s.w.p.DocumentationPluginsBootstrapper : Context refreshed
2020-02-28 17:12:05.749 INFO [my-project,,,] 5740 --- [ restartedMain] d.s.w.p.DocumentationPluginsBootstrapper : Found 1 custom documentation plugin(s) org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter#69e6f894]
2020-02-28 17:12:17.850 INFO [my-project,,,] 5740 --- [ restartedMain] s.d.s.w.s.ApiListingReferenceScanner : Scanning for api listing references
2020-02-28 17:13:54.484 INFO [my-project,,,] 5740 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2020-02-28 17:13:54.837 INFO [my-project,,,] 5740 --- [ restartedMain] c.d.i.b.p.MySpringBootApplication : Started MySpringBootApplication in 988.725 seconds (JVM running for 989.776)
2020-02-28 17:14:17.835 INFO [my-project,,,] 5740 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 6879 ms
2020-02-28 17:14:35.004 INFO [my-project,b5277242974c5225,b5277242974c5225,false] 5740 --- [nio-8080-exec-1] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at : https://config-server.my-company.org
2020-02-28 17:14:42.858 INFO [my-project,b5277242974c5225,b5277242974c5225,false] 5740 --- [nio-8080-exec-1] c.c.c.ConfigServicePropertySourceLocator : Located environment: name=my-project, profiles=[dev], label=null, version=c656a6ca556f4fc58135e673a7e5c4e97a2e5088, state=null
Any help or explanation would be appreciated.
Thanks
You probably have a breakpoint on a method call, those can slow down a Java application by quite a lot, instead if you can try to put your breakpoint on the first line of code in the method.
Breakpoints or conditional breakpoints usually cause this issue. Remove all breakpoints and run it.
I'm new to Spring Boot and I bought the book for Spring Boot 2.0 by Greg Turnsquit. In chapter 1 there is a simple application in which if I take a look to http://localhost:8080/chapters URL I'll be able to see the chapter list.
The error I'm having is that on the console the app prints the hashcode of the classes in the repository. In the web browser the app prints a dictionary with three empty elements.
Code Example: https://github.com/learning-spring-boot/learning-spring-boot-2nd-edition-code/tree/master/1
Chapter Controller
package com.greglturnquist.learningspringboot;
import reactor.core.publisher.Flux;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
#RestController
public class ChapterController {
private final ChapterRepository repository;
public ChapterController(ChapterRepository repository) {
this.repository = repository;
}
#GetMapping("/chapters")
public Flux<Chapter> listing() {
return repository.findAll();
}
}
Chapter Repository
package com.greglturnquist.learningspringboot;
import org.springframework.data.repository.reactive.ReactiveCrudRepository;
public interface ChapterRepository
extends ReactiveCrudRepository<Chapter, String> {
}
Loading of Database
package com.greglturnquist.learningspringboot;
import reactor.core.publisher.Flux;
import org.springframework.boot.CommandLineRunner;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
#Configuration
public class LoadDatabase {
#Bean
CommandLineRunner init(ChapterRepository repository) {
return args -> {
Flux.just(
new Chapter("Quick Start with Java"),
new Chapter("Reactive Web with Spring Boot"),
new Chapter("...and more!"))
.flatMap(repository::save)
.subscribe(System.out::println);
};
}
}
Fixes I tried
I know sometimes things can be cached in the web browser. I have killed the services running on the port the application is running in. I've also taken a look into the stack trace and there is no error relating to the app itself other than printing the hash of the Chapter objects and not the object information themselves. I'm assuming it might be related to web-flux. However, I'm unsure how the Chapter Repository interacts with web-flux and the embedded MongoDB.
Thanks in advance for any tips and suggestions.
Console log
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.0.0.M5)
2018-06-28 11:21:33.581 INFO 1804 --- [ main] c.g.l.LearningSpringBootApplication : Starting LearningSpringBootApplication on ARD-B3LM5R1 with PID 1804 (C:\DevTraining\Learning-Spring-Boot-2.0-Second-Edition\Chapter01\part1\out\production\classes started by nmartinez in C:\DevTraining\Learning-Spring-Boot-2.0-Second-Edition\Chapter01\part1)
2018-06-28 11:21:33.584 DEBUG 1804 --- [ main] c.g.l.LearningSpringBootApplication : Running with Spring Boot v2.0.0.M5, Spring v5.0.0.RELEASE
2018-06-28 11:21:33.585 INFO 1804 --- [ main] c.g.l.LearningSpringBootApplication : No active profile set, falling back to default profiles: default
2018-06-28 11:21:33.680 INFO 1804 --- [ main] .r.c.ReactiveWebServerApplicationContext : Refreshing org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext#5ccddd20: startup date [Thu Jun 28 11:21:33 EDT 2018]; root of context hierarchy
2018-06-28 11:21:34.969 WARN 1804 --- [ main] o.h.v.m.ParameterMessageInterpolator : HV000184: ParameterMessageInterpolator has been chosen, EL interpolation will not be supported
2018-06-28 11:21:35.383 WARN 1804 --- [ main] ion$DefaultTemplateResolverConfiguration : Cannot find template location: classpath:/templates/ (please add some templates or check your Thymeleaf configuration)
2018-06-28 11:21:35.575 INFO 1804 --- [ main] s.w.r.r.m.a.RequestMappingHandlerMapping : Mapped "{[/chapters],methods=[GET]}" onto public reactor.core.publisher.Flux<com.greglturnquist.learningspringboot.Chapter> com.greglturnquist.learningspringboot.ChapterController.listing()
2018-06-28 11:21:35.578 INFO 1804 --- [ main] s.w.r.r.m.a.RequestMappingHandlerMapping : Mapped "{[],methods=[GET]}" onto public java.lang.String com.greglturnquist.learningspringboot.HomeController.greeting(java.lang.String)
2018-06-28 11:21:35.664 INFO 1804 --- [ main] o.s.w.r.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.reactive.resource.ResourceWebHandler]
2018-06-28 11:21:35.664 INFO 1804 --- [ main] o.s.w.r.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.reactive.resource.ResourceWebHandler]
2018-06-28 11:21:35.684 WARN 1804 --- [ main] o.h.v.m.ParameterMessageInterpolator : HV000184: ParameterMessageInterpolator has been chosen, EL interpolation will not be supported
2018-06-28 11:21:35.753 INFO 1804 --- [ main] o.s.w.r.r.m.a.ControllerMethodResolver : Looking for #ControllerAdvice: org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext#5ccddd20: startup date [Thu Jun 28 11:21:33 EDT 2018]; root of context hierarchy
2018-06-28 11:21:36.812 INFO 1804 --- [ Thread-12] o.s.b.a.mongo.embedded.EmbeddedMongo : note: noprealloc may hurt performance in many applications
2018-06-28 11:21:36.813 INFO 1804 --- [ Thread-12] o.s.b.a.mongo.embedded.EmbeddedMongo : 2018-06-28T11:21:36.710-0400 I CONTROL [main] Hotfix KB2731284 or later update is not installed, will zero-out data files
2018-06-28 11:21:36.813 INFO 1804 --- [ Thread-12] o.s.b.a.mongo.embedded.EmbeddedMongo : 2018-06-28T11:21:36.712-0400 I CONTROL [initandlisten] MongoDB starting : pid=6980 port=51561 dbpath=C:\Users\NMARTI~1\AppData\Local\Temp\embedmongo-db-250ddd2d-2dba-4972-a86e-decdcbe4df3b 64-bit host=ARD-B3LM5R1
2018-06-28 11:21:36.813 INFO 1804 --- [ Thread-12] o.s.b.a.mongo.embedded.EmbeddedMongo : 2018-06-28T11:21:36.712-0400 I CONTROL [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R2
2018-06-28 11:21:36.813 INFO 1804 --- [ Thread-12] o.s.b.a.mongo.embedded.EmbeddedMongo : 2018-06-28T11:21:36.712-0400 I CONTROL [initandlisten] db version v3.2.2
2018-06-28 11:21:36.813 INFO 1804 --- [ Thread-12] o.s.b.a.mongo.embedded.EmbeddedMongo : 2018-06-28T11:21:36.712-0400 I CONTROL [initandlisten] git version: 6e71d0d568e134c029203593b00a0103e7cdf30b
2018-06-28 11:21:36.813 INFO 1804 --- [ Thread-12] o.s.b.a.mongo.embedded.EmbeddedMongo : 2018-06-28T11:21:36.712-0400 I CONTROL [initandlisten] allocator: tcmalloc
2018-06-28 11:21:36.813 INFO 1804 --- [ Thread-12] o.s.b.a.mongo.embedded.EmbeddedMongo : 2018-06-28T11:21:36.712-0400 I CONTROL [initandlisten] modules: none
2018-06-28 11:21:36.813 INFO 1804 --- [ Thread-12] o.s.b.a.mongo.embedded.EmbeddedMongo : 2018-06-28T11:21:36.712-0400 I CONTROL [initandlisten] build environment:
2018-06-28 11:21:36.814 INFO 1804 --- [ Thread-12] o.s.b.a.mongo.embedded.EmbeddedMongo : 2018-06-28T11:21:36.712-0400 I CONTROL [initandlisten] distmod: 2008plus
2018-06-28 11:21:36.814 INFO 1804 --- [ Thread-12] o.s.b.a.mongo.embedded.EmbeddedMongo : 2018-06-28T11:21:36.712-0400 I CONTROL [initandlisten] distarch: x86_64
2018-06-28 11:21:36.814 INFO 1804 --- [ Thread-12] o.s.b.a.mongo.embedded.EmbeddedMongo : 2018-06-28T11:21:36.712-0400 I CONTROL [initandlisten] target_arch: x86_64
2018-06-28 11:21:36.814 INFO 1804 --- [ Thread-12] o.s.b.a.mongo.embedded.EmbeddedMongo : 2018-06-28T11:21:36.712-0400 I CONTROL [initandlisten] options: { net: { bindIp: "127.0.0.1", http: { enabled: false }, port: 51561 }, security: { authorization: "disabled" }, storage: { dbPath: "C:\Users\NMARTI~1\AppData\Local\Temp\embedmongo-db-250ddd2d-2dba-4972-a86e-decdcbe4df3b", journal: { enabled: false }, mmapv1: { preallocDataFiles: false, smallFiles: true }, syncPeriodSecs: 0.0 } }
2018-06-28 11:21:36.814 INFO 1804 --- [ Thread-12] o.s.b.a.mongo.embedded.EmbeddedMongo : 2018-06-28T11:21:36.718-0400 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=4G,session_max=20000,eviction=(threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=0,log_size=2GB),statistics_log=(wait=0),,log=(enabled=false),
2018-06-28 11:21:36.860 INFO 1804 --- [ Thread-12] o.s.b.a.mongo.embedded.EmbeddedMongo : 2018-06-28T11:21:36.859-0400 W STORAGE [initandlisten] Detected configuration for non-active storage engine mmapv1 when current storage engine is wiredTiger
2018-06-28 11:21:36.861 INFO 1804 --- [ Thread-12] o.s.b.a.mongo.embedded.EmbeddedMongo : 2018-06-28T11:21:36.861-0400 I NETWORK [HostnameCanonicalizationWorker] Starting hostname canonicalization worker
2018-06-28 11:21:36.861 INFO 1804 --- [ Thread-12] o.s.b.a.mongo.embedded.EmbeddedMongo : 2018-06-28T11:21:36.861-0400 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory 'C:/Users/NMARTI~1/AppData/Local/Temp/embedmongo-db-250ddd2d-2dba-4972-a86e-decdcbe4df3b/diagnostic.data'
2018-06-28 11:21:36.904 INFO 1804 --- [ Thread-12] o.s.b.a.mongo.embedded.EmbeddedMongo : 2018-06-28T11:21:36.904-0400 I NETWORK [initandlisten] waiting for connections on port 51561
2018-06-28 11:21:36.904 INFO 1804 --- [ main] d.f.embed.process.runtime.Executable : start de.flapdoodle.embed.mongo.config.MongodConfigBuilder$ImmutableMongodConfig#3f1ddac2
2018-06-28 11:21:37.252 INFO 1804 --- [ main] org.mongodb.driver.cluster : Cluster created with settings {hosts=[localhost:51561], mode=MULTIPLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=500}
2018-06-28 11:21:37.252 INFO 1804 --- [ main] org.mongodb.driver.cluster : Adding discovered server localhost:51561 to client view of cluster
2018-06-28 11:21:37.297 INFO 1804 --- [ Thread-12] o.s.b.a.mongo.embedded.EmbeddedMongo : 2018-06-28T11:21:37.297-0400 I NETWORK [initandlisten] connection accepted from 127.0.0.1:51563 #1 (1 connection now open)
2018-06-28 11:21:37.323 INFO 1804 --- [localhost:51561] org.mongodb.driver.connection : Opened connection [connectionId{localValue:1, serverValue:1}] to localhost:51561
2018-06-28 11:21:37.326 INFO 1804 --- [localhost:51561] org.mongodb.driver.cluster : Monitor thread successfully connected to server with description ServerDescription{address=localhost:51561, type=STANDALONE, state=CONNECTED, ok=true, version=ServerVersion{versionList=[3, 2, 2]}, minWireVersion=0, maxWireVersion=4, maxDocumentSize=16777216, roundTripTimeNanos=831762}
2018-06-28 11:21:37.328 INFO 1804 --- [localhost:51561] org.mongodb.driver.cluster : Discovered cluster type of STANDALONE
2018-06-28 11:21:37.731 INFO 1804 --- [ main] org.mongodb.driver.cluster : Cluster created with settings {hosts=[localhost:51561], mode=MULTIPLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=500}
2018-06-28 11:21:37.731 INFO 1804 --- [ main] org.mongodb.driver.cluster : Adding discovered server localhost:51561 to client view of cluster
2018-06-28 11:21:37.734 INFO 1804 --- [ Thread-12] o.s.b.a.mongo.embedded.EmbeddedMongo : 2018-06-28T11:21:37.734-0400 I NETWORK [initandlisten] connection accepted from 127.0.0.1:51564 #2 (2 connections now open)
2018-06-28 11:21:37.737 INFO 1804 --- [localhost:51561] org.mongodb.driver.connection : Opened connection [connectionId{localValue:2, serverValue:2}] to localhost:51561
2018-06-28 11:21:37.737 INFO 1804 --- [localhost:51561] org.mongodb.driver.cluster : Monitor thread successfully connected to server with description ServerDescription{address=localhost:51561, type=STANDALONE, state=CONNECTED, ok=true, version=ServerVersion{versionList=[3, 2, 2]}, minWireVersion=0, maxWireVersion=4, maxDocumentSize=16777216, roundTripTimeNanos=336344}
2018-06-28 11:21:37.738 INFO 1804 --- [localhost:51561] org.mongodb.driver.cluster : Discovered cluster type of STANDALONE
2018-06-28 11:21:38.384 INFO 1804 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2018-06-28 11:21:38.669 INFO 1804 --- [ctor-http-nio-1] r.ipc.netty.tcp.BlockingNettyContext : Started HttpServer on /0:0:0:0:0:0:0:0:9001
2018-06-28 11:21:38.669 INFO 1804 --- [ main] o.s.b.web.embedded.netty.NettyWebServer : Netty started on port(s): 9001
2018-06-28 11:21:38.736 INFO 1804 --- [ Thread-12] o.s.b.a.mongo.embedded.EmbeddedMongo : 2018-06-28T11:21:38.736-0400 I NETWORK [initandlisten] connection accepted from 127.0.0.1:51565 #3 (3 connections now open)
2018-06-28 11:21:38.737 INFO 1804 --- [ Thread-12] o.s.b.a.mongo.embedded.EmbeddedMongo : 2018-06-28T11:21:38.737-0400 I NETWORK [initandlisten] connection accepted from 127.0.0.1:51566 #4 (4 connections now open)
2018-06-28 11:21:38.739 INFO 1804 --- [ Thread-12] o.s.b.a.mongo.embedded.EmbeddedMongo : 2018-06-28T11:21:38.738-0400 I NETWORK [initandlisten] connection accepted from 127.0.0.1:51567 #5 (5 connections now open)
2018-06-28 11:21:38.740 INFO 1804 --- [ main] c.g.l.LearningSpringBootApplication : Started LearningSpringBootApplication in 5.693 seconds (JVM running for 6.278)
2018-06-28 11:21:38.750 INFO 1804 --- [ Thread-17] org.mongodb.driver.connection : Opened connection [connectionId{localValue:4, serverValue:4}] to localhost:51561
2018-06-28 11:21:38.750 INFO 1804 --- [ Thread-20] org.mongodb.driver.connection : Opened connection [connectionId{localValue:5, serverValue:5}] to localhost:51561
2018-06-28 11:21:38.750 INFO 1804 --- [ Thread-18] org.mongodb.driver.connection : Opened connection [connectionId{localValue:3, serverValue:3}] to localhost:51561
com.greglturnquist.learningspringboot.Chapter#2043a52c
com.greglturnquist.learningspringboot.Chapter#5919de11
com.greglturnquist.learningspringboot.Chapter#393e1e5
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]