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]
Related
I am new to microservices where I have to use two services (which I have made in separate projects). And now I am trying to set up Eureka configuration in my application.yml file :
But it's throwing errors as can be seen in the screenshot above:
Nested mappings are not allowed in compact mapping
and
Multiple markers at this line:
- Nested mappings are not allowed in compact mapping
- Implicit keys need to be on a single line
Additionally, I tried with
I am sharing my EServerApplication.java code below:
package com.eserver;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
#SpringBootApplication
#EnableEurekaServer
public class EServerApplication {
public static void main(String[] args) {
SpringApplication.run(EServerApplication.class, args);
}
}
and below is my pom.xml file contents:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.3</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.eserver</groupId>
<artifactId>e_server</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>e_server</name>
<description>This is a microservice for eureka server</description>
<properties>
<java.version>11</java.version>
<spring-cloud.version>2021.0.0</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
But, when I do configure the same thing in application.properties file, it works well.
and below is the console output:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.6.3)
2022-01-27 14:52:11.965 INFO 14444 --- [ main] com.eserver.EServerApplication : Starting EServerApplication using Java 17.0.1 on SHAHFAISALKHAN with PID 14444 (C:\Users\shahf\Documents\workspace-spring-tool-suite-4-4.13.0.RELEASE\e_server\target\classes started by shahf in C:\Users\shahf\Documents\workspace-spring-tool-suite-4-4.13.0.RELEASE\e_server)
2022-01-27 14:52:11.970 INFO 14444 --- [ main] com.eserver.EServerApplication : No active profile set, falling back to default profiles: default
2022-01-27 14:52:13.550 INFO 14444 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=0f4543fa-8866-3a60-8d6e-f4ead7a36662
2022-01-27 14:52:13.981 INFO 14444 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8761 (http)
2022-01-27 14:52:13.993 INFO 14444 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2022-01-27 14:52:13.993 INFO 14444 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.56]
2022-01-27 14:52:14.275 INFO 14444 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2022-01-27 14:52:14.275 INFO 14444 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2203 ms
2022-01-27 14:52:15.013 INFO 14444 --- [ main] c.s.j.s.i.a.WebApplicationImpl : Initiating Jersey application, version 'Jersey: 1.19.4 05/24/2017 03:20 PM'
2022-01-27 14:52:15.089 INFO 14444 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using JSON encoding codec LegacyJacksonJson
2022-01-27 14:52:15.091 INFO 14444 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using JSON decoding codec LegacyJacksonJson
2022-01-27 14:52:15.299 INFO 14444 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using XML encoding codec XStreamXml
2022-01-27 14:52:15.300 INFO 14444 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using XML decoding codec XStreamXml
2022-01-27 14:52:19.162 INFO 14444 --- [ main] DiscoveryClientOptionalArgsConfiguration : Eureka HTTP Client uses Jersey
2022-01-27 14:52:19.326 WARN 14444 --- [ 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.
2022-01-27 14:52:19.393 INFO 14444 --- [ main] o.s.c.n.eureka.InstanceInfoFactory : Setting initial instance status as: STARTING
2022-01-27 14:52:19.494 INFO 14444 --- [ main] com.netflix.discovery.DiscoveryClient : Initializing Eureka in region us-east-1
2022-01-27 14:52:19.495 INFO 14444 --- [ main] com.netflix.discovery.DiscoveryClient : Client configured to neither register nor query for data.
2022-01-27 14:52:19.525 INFO 14444 --- [ main] com.netflix.discovery.DiscoveryClient : Discovery Client initialized at timestamp 1643275339522 with initial instances count: 0
2022-01-27 14:52:19.657 INFO 14444 --- [ main] c.n.eureka.DefaultEurekaServerContext : Initializing ...
2022-01-27 14:52:19.665 INFO 14444 --- [ main] c.n.eureka.cluster.PeerEurekaNodes : Adding new peer nodes [http://localhost:8761/eureka/]
2022-01-27 14:52:20.036 INFO 14444 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using JSON encoding codec LegacyJacksonJson
2022-01-27 14:52:20.036 INFO 14444 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using JSON decoding codec LegacyJacksonJson
2022-01-27 14:52:20.036 INFO 14444 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using XML encoding codec XStreamXml
2022-01-27 14:52:20.036 INFO 14444 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using XML decoding codec XStreamXml
2022-01-27 14:52:20.177 INFO 14444 --- [on(3)-127.0.0.1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2022-01-27 14:52:20.178 INFO 14444 --- [on(3)-127.0.0.1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2022-01-27 14:52:20.333 INFO 14444 --- [ main] c.n.eureka.cluster.PeerEurekaNodes : Replica node URL: http://localhost:8761/eureka/
2022-01-27 14:52:20.377 INFO 14444 --- [ main] c.n.e.registry.AbstractInstanceRegistry : Finished initializing remote region registries. All known remote regions: []
2022-01-27 14:52:20.386 INFO 14444 --- [ main] c.n.eureka.DefaultEurekaServerContext : Initialized
2022-01-27 14:52:20.396 INFO 14444 --- [on(3)-127.0.0.1] o.s.b.a.e.web.EndpointLinksResolver : Exposing 1 endpoint(s) beneath base path '/actuator'
2022-01-27 14:52:20.408 INFO 14444 --- [on(3)-127.0.0.1] o.s.web.servlet.DispatcherServlet : Completed initialization in 230 ms
2022-01-27 14:52:20.547 INFO 14444 --- [ main] o.s.c.n.e.s.EurekaServiceRegistry : Registering application UNKNOWN with eureka with status UP
2022-01-27 14:52:20.551 INFO 14444 --- [ Thread-9] o.s.c.n.e.server.EurekaServerBootstrap : Setting the eureka configuration..
2022-01-27 14:52:20.567 INFO 14444 --- [ Thread-9] o.s.c.n.e.server.EurekaServerBootstrap : isAws returned false
2022-01-27 14:52:20.568 INFO 14444 --- [ Thread-9] o.s.c.n.e.server.EurekaServerBootstrap : Initialized server context
2022-01-27 14:52:20.568 INFO 14444 --- [ Thread-9] c.n.e.r.PeerAwareInstanceRegistryImpl : Got 1 instances from neighboring DS node
2022-01-27 14:52:20.569 INFO 14444 --- [ Thread-9] c.n.e.r.PeerAwareInstanceRegistryImpl : Renew threshold is: 1
2022-01-27 14:52:20.570 INFO 14444 --- [ Thread-9] c.n.e.r.PeerAwareInstanceRegistryImpl : Changing status to UP
2022-01-27 14:52:20.606 INFO 14444 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8761 (http) with context path ''
2022-01-27 14:52:20.607 INFO 14444 --- [ main] .s.c.n.e.s.EurekaAutoServiceRegistration : Updating port to 8761
2022-01-27 14:52:20.692 INFO 14444 --- [ Thread-9] e.s.EurekaServerInitializerConfiguration : Started Eureka Server
2022-01-27 14:52:21.438 INFO 14444 --- [ main] com.eserver.EServerApplication : Started EServerApplication in 11.215 seconds (JVM running for 12.441)
2022-01-27 14:53:20.580 INFO 14444 --- [a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry : Running the evict task with compensationTime 0ms
2022-01-27 14:54:20.579 INFO 14444 --- [a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry : Running the evict task with compensationTime 0ms
Please guide me how can I can I fix the application.yml error.
EDIT: [SOLVED]
I found that this yml configuration file is sensitive to white-space of each components and hence I corrected it in my program. Closing the thread now!
yaml files follow a different naming convention. The following properties should resolve your issue.
eureka:
client:
register-with-eureka: false
fetch-registry: false
server:
wait-time-in-ms-when-sync-empty: 0
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
This is my first spring-boot application. I ran a sample code and it is getting stuck at "Initialized JPA EntityManagerFactory for persistence unit 'default' ".
Below is the code
package com.fredo.webservices.homefredoServcies;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
#SpringBootApplication
public class HomeFredoServciesApplication {
public static void main(String[] args) {
SpringApplication.run(HomeFredoServciesApplication.class, args);
}
}
below are the logs
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.3.0.RELEASE)
2020-06-07 20:58:15.807 INFO 1496 --- [ restartedMain] c.f.w.h.HomeFredoServciesApplication : Starting HomeFredoServciesApplication on ANGU with PID 1496 (C:\Users\ASUS\Desktop\java ms\home-fredoServcies\target\classes started by Angu in C:\Users\ASUS\Desktop\java ms\home-fredoServcies)
2020-06-07 20:58:15.811 INFO 1496 --- [ restartedMain] c.f.w.h.HomeFredoServciesApplication : No active profile set, falling back to default profiles: default
2020-06-07 20:58:15.881 INFO 1496 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2020-06-07 20:58:15.882 INFO 1496 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2020-06-07 20:58:16.799 INFO 1496 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFERRED mode.
2020-06-07 20:58:16.822 INFO 1496 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 13ms. Found 0 JPA repository interfaces.
2020-06-07 20:58:17.861 INFO 1496 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2020-06-07 20:58:17.876 INFO 1496 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2020-06-07 20:58:17.877 INFO 1496 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.35]
2020-06-07 20:58:18.038 INFO 1496 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2020-06-07 20:58:18.038 INFO 1496 --- [ restartedMain] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 2156 ms
2020-06-07 20:58:18.100 INFO 1496 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2020-06-07 20:58:18.335 INFO 1496 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2020-06-07 20:58:18.342 INFO 1496 --- [ restartedMain] o.s.b.a.h2.H2ConsoleAutoConfiguration : H2 console available at '/h2-console'. Database available at 'jdbc:h2:mem:b2c0eff5-9805-4a71-9f66-c6c863d910f5'
2020-06-07 20:58:18.548 INFO 1496 --- [ restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2020-06-07 20:58:18.629 INFO 1496 --- [ task-1] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2020-06-07 20:58:18.674 WARN 1496 --- [ restartedMain] 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
2020-06-07 20:58:18.720 INFO 1496 --- [ task-1] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.15.Final
2020-06-07 20:58:18.966 INFO 1496 --- [ task-1] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
2020-06-07 20:58:19.203 INFO 1496 --- [ task-1] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
2020-06-07 20:58:19.210 INFO 1496 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
2020-06-07 20:58:19.317 INFO 1496 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2020-06-07 20:58:19.322 INFO 1496 --- [ restartedMain] DeferredRepositoryInitializationListener : Triggering deferred initialization of Spring Data repositories…
2020-06-07 20:58:19.324 INFO 1496 --- [ restartedMain] DeferredRepositoryInitializationListener : Spring Data repositories initialized!
2020-06-07 20:58:19.344 INFO 1496 --- [ restartedMain] c.f.w.h.HomeFredoServciesApplication : Started HomeFredoServciesApplication in 3.985 seconds (JVM running for 4.795)
2020-06-07 20:58:19.554 INFO 1496 --- [ task-1] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2020-06-07 20:58:19.562 INFO 1496 --- [ task-1] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
I had same problem with application started by Eclipse and Spring Tool Run Configuration in Debug Mode.
A breakpoint was referencing a line on some removed block code, after removing faulty breakpoint, the application start new properly again.
Window-> Show View -> Breakpoints
try to hit http://localhost:8080/h2-console if you get response. your server is up and running. In logs it says H2 console available at '/h2-console'. Database available at 'jdbc:h2:mem:b2c0eff5-9805-4a71-9f66-c6c863d910f5'
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