SpringBoot app starts multiple times and disconnects from logstash - spring-boot

I have an springboot application (Spring Boot v1.3.5.RELEASE) that is run on docker with ./mvnw;
it "restarts" after 1-2 minutes and after second start they don't send any log to logstash..
in first start we see below log
2016-07-27 08:54:29,616 DEBUG [background-preinit] logging: Logging Provider: org.jboss.logging.Slf4jLoggerProvider found via system property
bug after the second one logging provider log is missing..
**2016-07-27 08:54:25,386 INFO [restartedMain] DemoApp: Starting DemoApp on 7adf92b8bc96 with PID 85 (/home/infoowl/project/target/classes started by infoowl in /home/infoowl/project)**
2016-07-27 08:54:25,471 DEBUG [restartedMain] DemoApp: Running with Spring Boot v1.3.5.RELEASE, Spring v4.2.6.RELEASE
2016-07-27 08:54:25,487 INFO [restartedMain] DemoApp: The following profiles are active: dev
2016-07-27 08:54:29,616 DEBUG [background-preinit] logging: Logging Provider: org.jboss.logging.Slf4jLoggerProvider found via system property
2016-07-27 08:54:32,436 INFO [restartedMain] DemoApp: Started DemoApp in 9.865 seconds (JVM running for 14.572)
2016-07-27 08:54:45,937 DEBUG [restartedMain] HttpURLConnection: sun.net.www.MessageHeader#3959b7066 pairs: {GET /config/transformation/dev/master HTTP/1.1: null}{Accept: application/json, application/*+json}{Authorization: Basic YWRtaW46YWRtaW4=}{User-Agent: Java/1.8.0_91}{Host: registry:8761}{Connection: keep-alive}
2016-07-27 08:54:46,512 DEBUG [restartedMain] HttpURLConnection: sun.net.www.MessageHeader#12bba63311 pairs: {null: HTTP/1.1 200 OK}{Server: Apache-Coyote/1.1}{X-Content-Type-Options: nosniff}{X-XSS-Protection: 1; mode=block}{Cache-Control: no-cache, no-store, max-age=0, must-revalidate}{Pragma: no-cache}{Expires: 0}{X-Application-Context: jhipster-registry:dev,native:8761}{Content-Type: application/json;charset=UTF-8}{Transfer-Encoding: chunked}{Date: Wed, 27 Jul 2016 08:54:46 GMT}
2016-07-27 08:54:46,777 INFO [restartedMain] DemoApp: The following profiles are active: dev
2016-07-27 08:55:01,347 WARN [restartedMain] ConfigurationClassPostProcessor: Cannot enhance #Configuration bean definition 'refreshScope' since its singleton instance has been created too early. The typical cause is a non-static #Bean method with a BeanDefinitionRegistryPostProcessor return type: Consider declaring such methods as 'static'.
2016-07-27 08:55:03,767 DEBUG [restartedMain] AsyncConfiguration: Creating Async Task Executor
2016-07-27 08:55:07,072 DEBUG [restartedMain] MetricsConfiguration: Registering JVM gauges
2016-07-27 08:55:07,169 DEBUG [restartedMain] MetricsConfiguration: Initializing Metrics JMX reporting
2016-07-27 08:55:07,281 INFO [restartedMain] MetricsConfiguration: Initializing Metrics Log reporting
2016-07-27 08:55:16,352 INFO [localhost-startStop-1] WebConfigurer: Web application configuration, using profiles: [dev]
2016-07-27 08:55:16,359 DEBUG [localhost-startStop-1] WebConfigurer: Initializing Metrics registries
2016-07-27 08:55:16,383 DEBUG [localhost-startStop-1] WebConfigurer: Registering Metrics Filter
2016-07-27 08:55:16,400 DEBUG [localhost-startStop-1] WebConfigurer: Registering Metrics Servlet
2016-07-27 08:55:16,402 INFO [localhost-startStop-1] WebConfigurer: Web application fully configured
2016-07-27 08:55:19,343 INFO [localhost-startStop-1] CoreApp: Running with Spring profile(s) : [dev]
2016-07-27 08:55:24,670 INFO [restartedMain] LoggingConfiguration: Initializing Logstash logging
2016-07-27 08:55:24,781 INFO [restartedMain] LoggingConfiguration: Logstash customFields: '{"app_name":"transformation","app_port":"9093","instance_id":"transformation:4afb19b3a2763ed887b8d69d246082e6"}', config: 'net.infoowl.hepsiburada.core.config.JHipsterProperties$Logging$Logstash#96d9ebe[enabled=true,host=elk-logstash,port=5000,queueSize=512]'
2016-07-27 08:55:35,367 DEBUG [restartedMain] CacheConfiguration: No cache
2016-07-27 08:55:40,071 DEBUG [restartedMain] DatabaseConfiguration: Configuring Mongeez
2016-07-27 08:55:40,245 INFO [restartedMain] FilesetXMLReader: Parsing XML Fileset file master.xml
2016-07-27 08:55:40,275 INFO [restartedMain] FilesetXMLReader: Num of changefiles found 0
2016-07-27 08:55:41,089 DEBUG [restartedMain] SwaggerConfiguration: Starting Swagger
2016-07-27 08:55:41,218 DEBUG [restartedMain] SwaggerConfiguration: Started Swagger in 118 ms
2016-07-27 08:55:55,610 WARN [restartedMain] URLConfigurationSource: No URLs will be polled as dynamic configuration sources.
2016-07-27 08:55:56,975 WARN [restartedMain] URLConfigurationSource: No URLs will be polled as dynamic configuration sources.
2016-07-27 08:56:00,036 DEBUG [cron4j::scheduler[20b6349f63f32eea2d00877b000001562b91269c7714a479]::launcher[20b6349f63f32eea238ca33a000001562b9155042b804084]] CronPlugin: Found crontab config url org.crsh.vfs.Resource#7a65b25c
**2016-07-27 08:56:00,788 INFO [restartedMain] DemoApp: Starting DemoApp on 7adf92b8bc96 with PID 85 (/home/infoowl/project/target/classes started by infoowl in /home/infoowl/project)**
2016-07-27 08:56:00,788 DEBUG [restartedMain] DemoApp: Running with Spring Boot v1.3.5.RELEASE, Spring v4.2.6.RELEASE
2016-07-27 08:56:00,788 INFO [restartedMain] DemoApp: The following profiles are active: dev
2016-07-27 08:56:01,290 INFO [restartedMain] DemoApp: Started DemoApp in 0.899 seconds (JVM running for 103.426)
another observation.. see second start is just "0.899 seconds" which is not possible.. Actually it seems second one is not a real start but logstash connection is gone..
What may be the reason for this second start? Where should I check and investigate;

From documentation:
Applications that use spring-boot-devtools will automatically restart
whenever files on the classpath change.
You can exclude resources or disable restarts.

I found the problem, the details are here;
https://github.com/spring-cloud/spring-cloud-stream/issues/605

Related

Hilla not starting Vite - what am I missing?

I have created a hilla app using this:
npx #vaadin/cli init --hilla --auth hilla-with-auth
Works fine!
Now I am trying to add that to an existing spring boot application, but I am having issues with Vite not starting as it should. No exception. No help in the debug output.
I have added:
relevant files in the root (package.json, vite.config.ts, etc.)
vaadin-featureflags.properties in resources folder
hilla dependencies in pom.xml as well as the build plugin
hill annotations to my application class (#Theme, #PWA) and made it extends SpringBootServletInitializer implements AppShellConfigurator
But even if everything seems to be initialized correctly, Vite does not start. Can anyone guide me in the right direction?
This is the most relevant output log:
2022-06-07 08:04:54.046 DEBUG 4947 --- [restartedMain] c.v.f.s.f.s.FullDependenciesScanner :
List of npm dependencies found in the project:
- #hilla/form 1.0.1 dev.hilla.EndpointController
....
2022-06-07 08:04:54.057 DEBUG 4947 --- [restartedMain] c.v.f.s.f.TaskGeneratePackageJson : writing file /Users/michael/Development/Previsto/previsto-server/target/flow-frontend/package.json.
2022-06-07 08:05:02.102 INFO 4947 --- [restartedMain] o.a.container.JSR356AsyncSupport : JSR 356 Mapping path /vaadinServlet
2022-06-07 08:05:02.176 INFO 4947 --- [restartedMain] c.v.f.s.DefaultDeploymentConfiguration :
Vaadin is running in DEBUG MODE.
When deploying application for production, remember to disable debug features. See more from https://vaadin.com/docs/
The following EXPERIMENTAL features are enabled:
- Use Vite for faster front-end builds
2022-06-07 08:05:02.207 DEBUG 4947 --- [restartedMain] c.v.f.s.c.PushRequestHandler : Using pre-initialized Atmosphere for servlet springServlet
2022-06-07 08:05:02.210 DEBUG 4947 --- [restartedMain] c.v.flow.server.VaadinServletService : Using 'com.vaadin.flow.server.communication.IndexHtmlRequestHandler' in client mode bootstrapping
2022-06-07 08:05:02.212 DEBUG 4947 --- [restartedMain] com.vaadin.flow.server.VaadinService : The application has the following routes:
2022-06-07 08:05:02.956 INFO 4947 --- [restartedMain] c.v.flow.server.frontend.FrontendTools : Project node version 16.10.0 is older than 16.14.0. Using node from /Users/michael/.vaadin.
2022-06-07 08:05:03.404 DEBUG 4947 --- [http-nio-8080-exec-1] c.v.f.s.s.VaadinDefaultRequestCache : Saving request to /
2022-06-07 08:05:03.471 DEBUG 4947 --- [http-nio-8080-exec-2] c.v.b.devserver.AbstractDevServerRunner : Requesting resource from Vite http://localhost:0/login
2022-06-07 08:05:03.486 ERROR 4947 --- [http-nio-8080-exec-2] o.a.c.c.C.[.[.[/].[springServlet] : Servlet.service() for servlet [springServlet] threw exception
java.net.ConnectException: Can't assign requested address (connect failed)
at ...

Grails 4 - Google Cloud Platform deployment keeps restarting

My Grails 4 application, deployed to GCP appears to be trying to start up after being deployed but never comes up properly. Application requests return a 500 response. There are no errors or clues with DEBUG log level output at the root level.
The same application runs fine locally in development mode.
The production configuration is as per the Grails 3 deployment (to GCP) guide except for the adjustments that were necessary to make it work for Grails 4/Java 11.
Most of the bootstrapping appears to carry out as expected;
Spring Security configures successfully
Spring Security REST configures successfully
Spring beans are registered
Connects to Cloud SQL instance
Database schema is created (by Liquibase)
Plugins are loaded successfully
Then it gets to the following familiar lines of output logging;
INFO --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
INFO --- [main] o.a.coyote.http11.Http11NioProtocol : Initializing ProtocolHandler ["http-nio-8080"]
INFO --- [main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
INFO --- [main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.17]
and restarts..
while normally, the next phase of bootstrapping (happens locally) would be;
[restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
[restartedMain] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 42018 ms
Probably a long shot question but any level of clues or suggestions would be much appreciated.
I've run out of doors to open. :-(
You could try to update Tomcat version just in case.
But looking at Grails documentation:
https://docs.grails.org/latest/guide/upgrading.html
There's some configuration made when you upgrade to Grails 4 from
Grails 3.3.x to prevents the server from restarting when views or
message bundles are changed.
Either modifying a gsp in Grails 4 M2 cause the application to restart.
https://github.com/grails/grails-core/issues/11284

Spring-Boot Server is not running, hangs after Initializing Spring FrameworkServlet 'dispatcherServlet

After running the spring-boot App, I'm getting the below logs:
Using below:
Kubernetes
Bit-Bucket Pipeline
MySQL and Oracle
Consul
Running Debug Mode
2019-07-17 10:33:03 [0] [main] INFO 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.
2019-07-17 10:33:11 [0] [http-nio-9080-exec-2] INFO o.a.c.c.C.[Tomcat].[localhost].[/] - Initializing Spring FrameworkServlet 'dispatcherServlet'

Why deploying the jHipster .war application to Tomcat 8 server keeps restarting application?

I've developed simple jHipster microservice and I'm trying to run it on Tomcat 8 server. It seems that tomcat is starting new instance of service after one is loaded, up and running.
I'm running web app as production app.
spring:
devtools:
restart:
enabled: false
livereload:
enabled: false
After couple instance is started server crashes.
Edit ( Please see log between one instance is deployed and another is starting up
2017-09-17 18:28:22.472 INFO 16950 --- [ost-startStop-1] pl.kx7.fb.pages.ApplicationWebXml : Started ApplicationWebXml in 52.059 seconds (JVM running for 66.585)
17-Sep-2017 18:28:22.610 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive [/opt/tomcat/webapps/pagesmanager-1.0.1-SNAPSHOT.war] has finished in [64,878] ms
17-Sep-2017 18:28:22.611 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/opt/tomcat/webapps/pm]
2017-09-17 18:28:31.973 INFO 16950 --- [freshExecutor-0] com.netflix.discovery.DiscoveryClient : Disable delta property : false
2017-09-17 18:28:31.973 INFO 16950 --- [freshExecutor-0] com.netflix.discovery.DiscoveryClient : Single vip registry refresh property : null
2017-09-17 18:28:31.973 INFO 16950 --- [freshExecutor-0] com.netflix.discovery.DiscoveryClient : Force full registry fetch : false
2017-09-17 18:28:31.974 INFO 16950 --- [freshExecutor-0] com.netflix.discovery.DiscoveryClient : Application is null : false
2017-09-17 18:28:31.974 INFO 16950 --- [freshExecutor-0] com.netflix.discovery.DiscoveryClient : Registered Applications size is zero : true
2017-09-17 18:28:31.974 INFO 16950 --- [freshExecutor-0] com.netflix.discovery.DiscoveryClient : Application version is -1: false
2017-09-17 18:28:31.975 INFO 16950 --- [freshExecutor-0] com.netflix.discovery.DiscoveryClient : Getting all instance registry info from the eureka server
2017-09-17 18:28:32.077 INFO 16950 --- [freshExecutor-0] com.netflix.discovery.DiscoveryClient : The response status is 200
[jHipster logo]
:: JHipster đ¤ :: Running Spring Boot 1.5.4.RELEASE ::
:: https://jhipster.github.io ::
2017-09-17 18:28:41.559 INFO 16950 --- [ost-startStop-1] pl.kx7.fb.pages.ApplicationWebXml : The following profiles are active: prod
2017-09-17 18:28:46.559 DEBUG 16950 --- [ost-startStop-1] p.k.fb.pages.config.AsyncConfiguration : Creating Async Task Executor
^C2017-09-17 18:28:46.722 WARN 16950 --- [ Thread-9] com.netflix.discovery.DiscoveryClient : Saw local status change event StatusChangeEvent [timestamp=1505665726722, current=DOWN, previous=UP]
Edit 2
It seems that problem is appearing after I've confiugured host for my app:
<Host name="pm.myhost.com" appBase="webapps" unpackWARs="true" autoDeploy="true">
<Alias>pm.myhost.com</Alias>
<Context path="" docBase="/opt/tomcat/webapps/pm" reloadable="true">
</Context>
</Host>

Exclude resources in Spring Cloud Sleuth

I am investigating integrating Spring Cloud Sleuth into a new Spring Boot service we are building and want to exclude certain URL's from generating spans for example health check endpoints which are polled periodically.
Checking the code I can see that the TraceFilter created in the TraceWebAutoConfiguration.java has a DEFAULT_SKIP_PATTERN which can be overridden by setting spring.sleuth.instrument.web.skipPattern.
However even if I access a resource under the DEFAULT_SKIP_PATTERN I am still observing that a trace & span are being created i.e.
17:28:46.142 [XNIO-2 task-1] INFO o.s.c.sleuth.log.Slf4jSpanListener - Starting span: MilliSpan(begin=1454394526140, end=0, name=http/info, traceId=908b24a3-143f-4949-8f86-5df867e3985b, parents=[], spanId=908b24a3-143f-4949-8f86-5df867e3985b, remote=false, exportable=false, annotations={}, processId=null, timelineAnnotations=[])
17:28:46.143 [XNIO-2 task-1] INFO o.s.c.sleuth.log.Slf4jSpanListener - Continued span: MilliSpan(begin=1454394526140, end=0, name=http/info, traceId=908b24a3-143f-4949-8f86-5df867e3985b, parents=[], spanId=908b24a3-143f-4949-8f86-5df867e3985b, remote=false, exportable=false, annotations={}, processId=null, timelineAnnotations=[])
17:28:46.146 [XNIO-2 task-1] INFO io.undertow.servlet - Initializing Spring FrameworkServlet 'dispatcherServlet'
17:28:46.146 [XNIO-2 task-1] INFO o.s.web.servlet.DispatcherServlet - FrameworkServlet 'dispatcherServlet': initialization started
17:28:46.170 [XNIO-2 task-1] INFO o.s.web.servlet.DispatcherServlet - FrameworkServlet 'dispatcherServlet': initialization completed in 24 ms
17:28:46.216 [XNIO-2 task-1] INFO o.s.c.sleuth.log.Slf4jSpanListener - Stopped span: MilliSpan(begin=1454394526140, end=1454394526215, name=http/info, traceId=908b24a3-143f-4949-8f86-5df867e3985b, parents=[], spanId=908b24a3-143f-4949-8f86-5df867e3985b, remote=false, exportable=false, annotations={}, processId=null, timelineAnnotations=[])
Am I missing something? I am currently using 1.0.0.M4
A skipped resource does not stop a span from being created, it only stops the data from being collected and exported. So your logs look normal to me. In snapshots you would see the "exportable" flag set to false in skipped resources.

Resources