Hilla not starting Vite - what am I missing? - spring-boot

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

Related

Clone of start.spring.io

I'm trying to build an instance of start.spring.io to use it in an air-gaped network. I have been working on it for three weeks and still I don't understand well what to do.
I have cloned start.spring.io from GitHub in a host connected to Internet.
There I can build the application without errors:
./mvnw clean install -DskipTests=true
Then if I true to run the application (../mwnw spring-boot:run from the start-site directory), I get the following error when the application starts, I mean is not an error trying to generate a project, and the application dies:
2022-12-19 17:53:21.170 INFO 2701 --- [ restartedMain] o.s.b.a.w.s.WelcomePageHandlerMapping : Adding welcome page: class path resource [static/index.html]
2022-12-19 17:53:21.264 WARN 2701 --- [ restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [io.spring.initializr.web.controller.ProjectGenerationController] from ClassLoader [jdk.internal.loader.ClassLoaders$AppClassLoader#5cb0d902]
2022-12-19 17:53:21.272 INFO 2701 --- [ restartedMain] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2022-12-19 17:53:21.311 INFO 2701 --- [ restartedMain] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-12-19 17:53:21.411 ERROR 2701 --- [ restartedMain] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [io.spring.initializr.web.controller.ProjectGenerationController] from ClassLoader [jdk.internal.loader.ClassLoaders$AppClassLoader#5cb0d902]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1804) ~[spring-beans-5.3.23.jar:5.3.23]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620) ~[spring-beans-5.3.23.jar:5.3.23]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.23.jar:5.3.23]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$
...
So, I am not adding any special dependencies or initilializr dependencies other than those already included in the project. I use Java 17 from Bell Soft.
I am not about the Spring Boot version but I haven't modified anything in the project. The pom file in the top directory includes:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.5</version>
</parent>
About my dependencies I am using the initializer-bom:0.20.0-SNAPSHOT. I have also tried with other versions like 0.13.0 and 0.12.0 but the build fails in both cases for the start-site:
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /workspaces/start.spring.io.ori/start-site/src/main/java/io/spring/start/site/extension/dependency/springcloud/SpringCloudContractKotlinDslGradleBuildCustomizer.java:[44,22] cannot find symbol
symbol: method snippets()
location: variable build of type io.spring.initializr.generator.buildsystem.gradle.GradleBuild
[ERROR] /workspaces/start.spring.io.ori/start-site/src/main/java/io/spring/start/site/extension/dependency/graalvm/HibernatePluginGroovyDslGradleBuildCustomizer.java:[39,22] cannot find symbol
symbol: method snippets()
location: variable build of type io.spring.initializr.generator.buildsystem.gradle.GradleBuild
[ERROR] /workspaces/start.spring.io.ori/start-site/src/main/java/io/spring/start/site/extension/dependency/springcloud/SpringCloudContractGroovyDslGradleBuildCustomizer.java:[36,22] cannot find symbol
symbol: method snippets()
location: variable build of type io.spring.initializr.generator.buildsystem.gradle.GradleBuild
[INFO] 3 errors
I wonder if this effort makes sense. If I manage to build the application, will I be able of generating code or does the application connect to somewhere else to retrieve the data required to generate the code?
I would appreciate any hints. Thanks
I will write my (potential) answer here, even though I don't really think that is a real answer but too big to make it as a comment.
My setup:
Amazon Coretto JDK 17 https://docs.aws.amazon.com/corretto/latest/corretto-17-ug/downloads-list.html (it is not JDK 17 from Bell Soft)
Windows 11 Home
So I went to https://github.com/spring-io/start.spring.io and cloned it.
git clone https://github.com/spring-io/start.spring.io.git
Then I went in the root directoy of the cloned project and ran following command:
./mvnw clean install
Here I got some errors while running the tests, but this shouldn't be way too tragic - I think they failed for me, because it tries to run some gradlew commands but they do fail, because I don't have Gradle installed on my PC, as I am always using the Gradle Wrapper.
Then I started the Spring Boot Application.
cd start-site
../mvnw spring-boot:run
The Spring Boot Application started:
022-12-20T15:01:03.510+01:00 INFO 16592 --- [ restartedMain] io.spring.start.site.StartApplication : No active profile set, falling back to 1 default profile: "default"
2022-12-20T15:01:03.573+01:00 INFO 16592 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2022-12-20T15:01:03.573+01:00 INFO 16592 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2022-12-20T15:01:04.800+01:00 INFO 16592 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2022-12-20T15:01:04.809+01:00 INFO 16592 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2022-12-20T15:01:04.810+01:00 INFO 16592 --- [ restartedMain] o.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/10.1.1]
2022-12-20T15:01:04.872+01:00 INFO 16592 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2022-12-20T15:01:04.873+01:00 INFO 16592 --- [ restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1298 ms
2022-12-20T15:01:05.371+01:00 INFO 16592 --- [ restartedMain] o.s.b.a.w.s.WelcomePageHandlerMapping : Adding welcome page: class path resource [static/index.html]
2022-12-20T15:01:05.823+01:00 INFO 16592 --- [ restartedMain] org.ehcache.core.EhcacheManager : Cache 'initializr.metadata' created in EhcacheManager.
2022-12-20T15:01:05.832+01:00 INFO 16592 --- [ restartedMain] org.ehcache.jsr107.Eh107CacheManager : Registering Ehcache MBean javax.cache:type=CacheConfiguration,CacheManager=urn.X-ehcache.jsr107-default-config,Cache=initializr.metadata
2022-12-20T15:01:05.832+01:00 INFO 16592 --- [ restartedMain] org.ehcache.jsr107.Eh107CacheManager : Registering Ehcache MBean javax.cache:type=CacheStatistics,CacheManager=urn.X-ehcache.jsr107-default-config,Cache=initializr.metadata
2022-12-20T15:01:05.835+01:00 INFO 16592 --- [ restartedMain] org.ehcache.core.EhcacheManager : Cache 'initializr.dependency-metadata' created in EhcacheManager.
2022-12-20T15:01:05.836+01:00 INFO 16592 --- [ restartedMain] org.ehcache.jsr107.Eh107CacheManager : Registering Ehcache MBean javax.cache:type=CacheConfiguration,CacheManager=urn.X-ehcache.jsr107-default-config,Cache=initializr.dependency-metadata
2022-12-20T15:01:05.836+01:00 INFO 16592 --- [ restartedMain] org.ehcache.jsr107.Eh107CacheManager : Registering Ehcache MBean javax.cache:type=CacheStatistics,CacheManager=urn.X-ehcache.jsr107-default-config,Cache=initializr.dependency-metadata
2022-12-20T15:01:05.839+01:00 INFO 16592 --- [ restartedMain] org.ehcache.core.EhcacheManager : Cache 'initializr.project-resources' created in EhcacheManager.
2022-12-20T15:01:05.841+01:00 INFO 16592 --- [ restartedMain] org.ehcache.jsr107.Eh107CacheManager : Registering Ehcache MBean javax.cache:type=CacheConfiguration,CacheManager=urn.X-ehcache.jsr107-default-config,Cache=initializr.project-resources
2022-12-20T15:01:05.841+01:00 INFO 16592 --- [ restartedMain] org.ehcache.jsr107.Eh107CacheManager : Registering Ehcache MBean javax.cache:type=CacheStatistics,CacheManager=urn.X-ehcache.jsr107-default-config,Cache=initializr.project-resources
2022-12-20T15:01:05.843+01:00 INFO 16592 --- [ restartedMain] org.ehcache.core.EhcacheManager : Cache 'initializr.templates' created in EhcacheManager.
2022-12-20T15:01:05.843+01:00 INFO 16592 --- [ restartedMain] org.ehcache.jsr107.Eh107CacheManager : Registering Ehcache MBean javax.cache:type=CacheConfiguration,CacheManager=urn.X-ehcache.jsr107-default-config,Cache=initializr.templates
2022-12-20T15:01:05.844+01:00 INFO 16592 --- [ restartedMain] org.ehcache.jsr107.Eh107CacheManager : Registering Ehcache MBean javax.cache:type=CacheStatistics,CacheManager=urn.X-ehcache.jsr107-default-config,Cache=initializr.templates
2022-12-20T15:01:06.026+01:00 INFO 16592 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
2022-12-20T15:01:06.031+01:00 INFO 16592 --- [ restartedMain] o.s.b.a.e.web.EndpointLinksResolver : Exposing 2 endpoint(s) beneath base path '/actuator'
2022-12-20T15:01:06.078+01:00 INFO 16592 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2022-12-20T15:01:06.089+01:00 INFO 16592 --- [ restartedMain] io.spring.start.site.StartApplication : Started StartApplication in 3.056 seconds (process running for 3.444)
2022-12-20T15:01:17.890+01:00 INFO 16592 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2022-12-20T15:01:17.891+01:00 INFO 16592 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2022-12-20T15:01:17.892+01:00 INFO 16592 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 1 ms
2022-12-20T15:01:18.122+01:00 INFO 16592 --- [io-8080-exec-10] .s.SaganInitializrMetadataUpdateStrategy : Fetching Spring Boot metadata from https://spring.io/project_metadata/spring-boot
If I now call http://localhost:8080/ - it works, I didn't do absolutely nothing.
Could it maybe be your JDK? I mean the JDKs are similar but not the same... And you also asked:
I wonder if this effort makes sense. If I manage to build the
application, will I be able of generating code or does the application
connect to somewhere else to retrieve the data required to generate
the code? I would appreciate any hints. Thanks
I personally think, it could make sense but - as soon as I generated a project on my own Spring Initializr, I watched the console of the Spring Boot Application and could see the following log:
Fetching Spring Boot metadata from https://spring.io/project_metadata/spring-boot
So it looks, like this thing actually fetches data from the internet, now I don't know what options you have but I have two in mind.
You could try to fork the GitHub Project and try to remove this network call (if this is really the only one) - I couldn't see anything more in the logs atleast... The actual response of the Call looks pretty simple though:
{"id":"spring-boot","name":"Spring Boot","projectReleases":[{"version":"3.0.1-SNAPSHOT","versionDisplayName":"3.0.1-SNAPSHOT","current":false,"releaseStatus":"SNAPSHOT","snapshot":true},{"version":"3.0.0","versionDisplayName":"3.0.0","current":true,"releaseStatus":"GENERAL_AVAILABILITY","snapshot":false},{"version":"2.7.7-SNAPSHOT","versionDisplayName":"2.7.7-SNAPSHOT","current":false,"releaseStatus":"SNAPSHOT","snapshot":true},{"version":"2.7.6","versionDisplayName":"2.7.6","current":false,"releaseStatus":"GENERAL_AVAILABILITY","snapshot":false},{"version":"2.6.14","versionDisplayName":"2.6.14","current":false,"releaseStatus":"GENERAL_AVAILABILITY","snapshot":false},{"version":"2.5.14","versionDisplayName":"2.5.14","current":false,"releaseStatus":"GENERAL_AVAILABILITY","snapshot":false},{"version":"2.4.13","versionDisplayName":"2.4.13","current":false,"releaseStatus":"GENERAL_AVAILABILITY","snapshot":false}]}
You allow explicitly the URL https://spring.io/project_metadata/spring-boot to fetch data inside of your Air Gap Network (I don't know if this is viable though)
I hope this helps a bit?
There are many dependencies that start from the initializer for spring-boot. If you try to build within an air-gapped network, you will not have access to maven's repository for the dependencies. Try building the package outside the network, and capture the libraries required. Look to your ~/.m2/ folder for the copies of the libraries needed. I would recommend setting up a Nexus repository, and it will capture the libraries as you need them from an open network which you can then use on the air-gapped network.
If this is a secured network, you'll have to have all those files vetted and scanned before you can get them into the air-gapped network. Plan for this.
As you add additional annotations or dependencies, you will have to get them from maven central again. It's not ideal, but you might find someone who setup a project to include all spring-boot dependencies for just this situation.
Also, use the STS dev environment, and build your spring-boot to run with included libraries.

Vaadin 23 Flow - Spring Boot - Live Reload not working

I recently updated my Vaadin Flow Project to the newest Version 23.0.1.
It all did great, but the LiveReload (detecting Java-FileChanges) doesnt work at all (Its detecting only CSS changes).
I created a new Spring Boot Vaadin 23 Project with Spring-Initializr to check if it's the same problem. I followed the LiveReload Section in the official Vaadin Docs, but it does'nt work at all... :(
My Console shows no errors at all..
Does someone have a similar Problem?
Console Output:
2022-03-21 12:28:33.379 INFO 16300 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
[.....]
2022-03-21 12:28:33.814 INFO 16300 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8081 (http) with context path ''
2022-03-21 12:28:33.827 INFO 16300 --- [ restartedMain] n.b.p.s.PlatonStartupApplicationListener : Initialize Application
2022-03-21 12:28:33.828 INFO 16300 --- [ restartedMain] n.b.p.s.PlatonStartupApplicationListener : Load global catalog.
2022-03-21 12:28:33.987 INFO 16300 --- [nio-8081-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2022-03-21 12:28:33.988 INFO 16300 --- [nio-8081-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2022-03-21 12:28:33.992 INFO 16300 --- [nio-8081-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 2 ms
2022-03-21 12:28:38.306 INFO 16300 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : [build-status] : Compiled.
←[38;5;35m
----------------- Frontend compiled successfully. -----------------
←[0m2022-03-21 12:28:38.313 INFO 16300 --- [onPool-worker-3] c.v.b.devserver.AbstractDevServerRunner : Started Webpack. Time: 9897ms
2022-03-21 12:28:38.382 INFO 16300 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker : No issues found.

Spring Boot and Axis2 client runtime issue with Rampart

I am trying to use Axis 2 client to work with a soap based web service. I use Rampart 1.7.1 for WSO Authentication. After I created the stub code using axis2tools I installed the jar files into maven repository and use them as dependency in my pom.xml file. Also I use spring boot for the rest of application which I use the generated libraries as soap client api.
Everything is good in dev environment I can work with web service. And also when I use
mvn spring-boot:run
it works fine and webservice communication is good from UI to Webservice and back(end to end).
when I use
java -jar target/fatjar.jar
When I send request to web service I receive the following error at console:
2017-11-17 16:00:35.140 WARN 31114 --- [nio-8080-exec-2] o.a.axis2.deployment.AxisConfigBuilder : Unable to instantiate deployer org.apache.axis2.deployment.ServiceDeployer; see debug logs for more details
2017-11-17 16:00:35.161 INFO 31114 --- [nio-8080-exec-2] o.a.axis2.deployment.DeploymentEngine : No services directory was found under /home/mehdi/Workspace/EclipseWS/src/main/resources/axis.
2017-11-17 16:00:35.179 INFO 31114 --- [nio-8080-exec-2] o.a.axis2.deployment.ModuleDeployer : Deploying module: rampart-1.7.1 - file:/home/mehdi/Workspace/EclipseWS/src/main/resources/axis/modules/rampart-1.7.1.mar
2017-11-17 16:00:35.185 ERROR 31114 --- [nio-8080-exec-2] o.a.axis2.deployment.ModuleDeployer : The rampart-1.7.1.jar module, which is not valid, caused The /home/mehdi/Workspace/EclipseWS/target/cybersourceClient-0.0.1-SNAPSHOT.jar!/BOOT-INF/lib/rampart-1.7.1.jar file cannot be found.
org.apache.axis2.AxisFault: The /home/mehdi/Workspace/EclipseWS/target/cybersourceClient-0.0.1-SNAPSHOT.jar!/BOOT-INF/lib/rampart-1.7.1.jar file cannot be found.
at org.apache.axis2.deployment.repository.util.DeploymentFileData.setClassLoader(DeploymentFileData.java:118) [axis2-kernel-1.7.1.jar!/:1.7.1]
at org.apache.axis2.deployment.ModuleDeployer.deploy(ModuleDeployer.java:133) ~[axis2-kernel-1.7.1.jar!/:1.7.1]
at org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(DeploymentFileData.java:144) [axis2-kernel-1.7.1.jar!/:1.7.1]
at org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:585) [axis2-kernel-1.7.1.jar!/:1.7.1]
at org.apache.axis2.deployment.RepositoryListener.loadClassPathModules(RepositoryListener.java:222) [axis2-kernel-1.7.1.jar!/:1.7.1]
same line when I use "mvn spring-boot:run" is
2017-11-17 16:13:14.270 WARN 7823 --- [nio-8080-exec-9] o.a.axis2.deployment.AxisConfigBuilder : Unable to instantiate deployer org.apache.axis2.deployment.ServiceDeployer; see debug logs for more details
2017-11-17 16:13:14.286 INFO 7823 --- [nio-8080-exec-9] o.a.axis2.deployment.DeploymentEngine : No services directory was found under /home/mehdi/Workspace/EclipseWS/src/main/resources/axis.
2017-11-17 16:13:14.301 INFO 7823 --- [nio-8080-exec-9] o.a.axis2.deployment.ModuleDeployer : Deploying module: rampart-1.7.1 - file:/home/mehdi/Workspace/EclipseWS/src/main/resources/axis/modules/rampart-1.7.1.mar
2017-11-17 16:13:14.304 INFO 7823 --- [nio-8080-exec-9] o.a.axis2.deployment.ModuleDeployer : Deploying module: rampart-1.7.1 - file:/home/mehdi/.m2/repository/org/apache/rampart/rampart/1.7.1/rampart-1.7.1.jar
Please notice that it fails for:
...The rampart-1.7.1.jar module, which is not valid,...
I don't know why with maven launch it works but with java -jar throws exception.
According to Spring Boot documentation (Further Config section) in here
I needed to add the rampart library to unpacked list in spring-boot-maven-plugin as follows:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<requiresUnpack>
<requiresUnpack>
<groupId>org.apache.rampart</groupId>
<artifactId>rampart</artifactId>
</requiresUnpack>
</requiresUnpack>
</configuration>
</plugin>

SpringBoot app starts multiple times and disconnects from logstash

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

mvn spring-boot:run vs Run

I'm testing spring-boot-devtools with livereload on intelliJ.
I have simple SpringBootApplication that works fine.
When I start the app from maven command "mvn spring-boot:run" all works fine excepting that livereload server dont' start. No message on console appears and the chrome extensions show error that It's not possible to connect to livereload server.
If I start app with (right mousse button/Run Application.java), all works fine even livereload server. Message appears on console and browser is able to connect to livereload server.
Starting app from right mousse button/Run Application.java
Console message
2016-07-13 16:39:47.947 INFO 10440 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-07-13 16:39:48.026 INFO 10440 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
2016-07-13 16:39:48.077 INFO 10440 --- [ restartedMain] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2016-07-13 16:39:48.145 INFO 10440 --- [ restartedMain] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8090 (http)
Starting app from mvn command "mvn spring-boot:run"
Chorme extension message:
Could not connect to LiveReload server. Please make sure that a compatible LiveReload server is running. (We recommend guard-livereload, until LiveReload2 comes to your platform.)
Console message. See that not show message LiveReload server is running on port....
2016-07-13 16:38:56.749 INFO 6924 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-07-13 16:38:56.852 INFO 6924 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2016-07-13 16:38:56.898 INFO 6924 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8090 (http)
Why maven command don't start livereload server?
You need to tell Maven to fork a separate JVM to run your application, rather than it running in the same JVM as Maven:
$ mvn spring-boot:run -Dfork=true

Resources