SpringBoot 2.0 VERY slow to start up on MacOS Sierra - spring-boot

Has anyone experienced a very slow startup time for SpringBoot 2.0 on MacOS Sierra?
My pom is nothing more than this (snippet):
...
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.RELEASE</version>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
...
It takes 22 seconds to start up:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.0.0.RELEASE)
2018-03-13 23:24:58.160 INFO 20517 --- [ main] jekyll.publisher.ServerApplication : Starting ServerApplication on MacBook-Pro.local with PID 20517 (/Users/workspace/jekyll-publisher/target/classes started by xxxx in /Users/workspace/jekyll-publisher)
2018-03-13 23:24:58.163 INFO 20517 --- [ main] jekyll.publisher.ServerApplication : No active profile set, falling back to default profiles: default
2018-03-13 23:24:58.190 INFO 20517 --- [ main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext#8909f18: startup date [Tue Mar 13 23:24:58 EDT 2018]; root of context hierarchy
2018-03-13 23:24:58.736 INFO 20517 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2018-03-13 23:24:58.748 INFO 20517 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2018-03-13 23:24:58.749 INFO 20517 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.28
2018-03-13 23:24:58.752 INFO 20517 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/Users/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.]
2018-03-13 23:24:58.795 INFO 20517 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2018-03-13 23:24:58.795 INFO 20517 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 607 ms
2018-03-13 23:24:58.878 INFO 20517 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2018-03-13 23:24:58.879 INFO 20517 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2018-03-13 23:24:58.879 INFO 20517 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2018-03-13 23:24:58.879 INFO 20517 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2018-03-13 23:24:58.879 INFO 20517 --- [ost-startStop-1] .s.DelegatingFilterProxyRegistrationBean : Mapping filter: 'springSecurityFilterChain' to: [/*]
2018-03-13 23:24:58.880 INFO 20517 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Servlet dispatcherServlet mapped to [/]
2018-03-13 23:24:58.902 INFO 20517 --- [ main] j.publisher.web.ping.PingController : Ping on the server was successful.
2018-03-13 23:24:59.044 INFO 20517 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for #ControllerAdvice: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext#8909f18: startup date [Tue Mar 13 23:24:58 EDT 2018]; root of context hierarchy
2018-03-13 23:24:59.081 INFO 20517 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],methods=[POST],produces=[text/html]}" onto public java.lang.String jekyll.publisher.web.error.ForwardingErrorController.forwardOnError()
2018-03-13 23:24:59.084 INFO 20517 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/api/ping],methods=[GET]}" onto public jekyll.publisher.web.ping.PingResponse jekyll.publisher.web.ping.PingController.ping(javax.servlet.http.HttpSession)
2018-03-13 23:24:59.103 INFO 20517 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-03-13 23:24:59.104 INFO 20517 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-03-13 23:24:59.123 INFO 20517 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-03-13 23:24:59.134 INFO 20517 --- [ main] o.s.b.a.w.s.WelcomePageHandlerMapping : Adding welcome page: class path resource [static/index.html]
2018-03-13 23:24:59.225 INFO 20517 --- [ main] .s.s.UserDetailsServiceAutoConfiguration :
Using generated security password: 8edea141-84e2-4ab5-b799-0cf09c464b53
2018-03-13 23:24:59.324 INFO 20517 --- [ main] o.s.s.web.DefaultSecurityFilterChain : Creating filter chain: org.springframework.security.web.util.matcher.AnyRequestMatcher#1, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter#6813a331, org.springframework.security.web.context.SecurityContextPersistenceFilter#22df874e, org.springframework.security.web.header.HeaderWriterFilter#377c68c6, org.springframework.security.web.csrf.CsrfFilter#3961a41a, org.springframework.security.web.authentication.logout.LogoutFilter#537b32ef, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#607b2792, org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter#261d8190, org.springframework.security.web.authentication.www.BasicAuthenticationFilter#99a65d3, org.springframework.security.web.savedrequest.RequestCacheAwareFilter#5bdaf2ce, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter#778ca8ef, org.springframework.security.web.authentication.AnonymousAuthenticationFilter#1bd81830, org.springframework.security.web.session.SessionManagementFilter#238ad8c, org.springframework.security.web.access.ExceptionTranslationFilter#7d0332e1, org.springframework.security.web.access.intercept.FilterSecurityInterceptor#76adb233]
2018-03-13 23:24:59.373 INFO 20517 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2018-03-13 23:24:59.406 INFO 20517 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2018-03-13 23:24:59.409 INFO 20517 --- [ main] jekyll.publisher.ServerApplication : Started ServerApplication in 16.429 seconds (JVM running for 22.012)
Any ideas?
Ok, StackOverflow is making me add "more details". Not sure what else to add here.

Ok, figured it out. It had nothing to do with Spring Boot 2.0. Just happened to coincide with that upgrade.
The real answer is from this StackOverflow:
Maven with Surefire (TestNG) is slow after update to MacOS Sierra

Set it like this
open your terminal and run hostname
$ hostname
xxx.local
modify the host config in file /etc/hosts
127.0.0.1 localhost xxx.local
::1 localhost xxx.local

Related

Spring Boot - Thymeleaf - New project does not work

I need help to start a new project with spring boot.
I used spring tool suite 4 "spring starter project".
I followed all the steps of the guide correctly, but once I run localhost:8080 it tells me that it's impossible to reach the site.
In problem's section, i've 0 problems and warnings.
my pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>it.progettoThymeleaf</groupId>
<artifactId>progettoThymeleaf</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>MyNewProject</name>
<description>Nuov progetto ThymeLeaf</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-integration</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-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>
My .log file:
!ENTRY org.eclipse.jdt.debug 2 0 2020-10-08 21:09:12.334
!MESSAGE Unable to find location of java.lang.Thread.setName() in debuggee JVM, for type java.lang.Thread
Thank you
THE NEW CONSOLE OUTPUT:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.3.4.RELEASE)
2020-10-08 21:43:13.953 INFO 19656 --- [ restartedMain] i.p.start.MyNewProjectApplication : Starting MyNewProjectApplication on griccipw10 with PID 19656 (C:\Progetto Thymeleaf\Workspace\MyNewProject\target\classes started by gricci in C:\Progetto Thymeleaf\Workspace\MyNewProject)
2020-10-08 21:43:13.960 INFO 19656 --- [ restartedMain] i.p.start.MyNewProjectApplication : No active profile set, falling back to default profiles: default
2020-10-08 21:43:14.051 INFO 19656 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2020-10-08 21:43:14.051 INFO 19656 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2020-10-08 21:43:15.087 INFO 19656 --- [ restartedMain] faultConfiguringBeanFactoryPostProcessor : No bean named 'errorChannel' has been explicitly defined. Therefore, a default PublishSubscribeChannel will be created.
2020-10-08 21:43:15.105 INFO 19656 --- [ restartedMain] faultConfiguringBeanFactoryPostProcessor : No bean named 'taskScheduler' has been explicitly defined. Therefore, a default ThreadPoolTaskScheduler will be created.
2020-10-08 21:43:15.110 INFO 19656 --- [ restartedMain] faultConfiguringBeanFactoryPostProcessor : No bean named 'integrationHeaderChannelRegistry' has been explicitly defined. Therefore, a default DefaultHeaderChannelRegistry will be created.
2020-10-08 21:43:15.199 INFO 19656 --- [ restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.integration.config.IntegrationManagementConfiguration' of type [org.springframework.integration.config.IntegrationManagementConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-10-08 21:43:15.212 INFO 19656 --- [ restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'integrationChannelResolver' of type [org.springframework.integration.support.channel.BeanFactoryChannelResolver] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-10-08 21:43:15.215 INFO 19656 --- [ restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'integrationDisposableAutoCreatedBeans' of type [org.springframework.integration.config.annotation.Disposables] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-10-08 21:43:15.615 INFO 19656 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2020-10-08 21:43:15.627 INFO 19656 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2020-10-08 21:43:15.627 INFO 19656 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.38]
2020-10-08 21:43:15.949 INFO 19656 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2020-10-08 21:43:15.949 INFO 19656 --- [ restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1898 ms
2020-10-08 21:43:16.267 INFO 19656 --- [ restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2020-10-08 21:43:16.283 DEBUG 19656 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerAdapter : ControllerAdvice beans: 0 #ModelAttribute, 0 #InitBinder, 1 RequestBodyAdvice, 1 ResponseBodyAdvice
2020-10-08 21:43:16.365 DEBUG 19656 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : 2 mappings in 'requestMappingHandlerMapping'
2020-10-08 21:43:16.399 DEBUG 19656 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Patterns [/webjars/**, /**] in 'resourceHandlerMapping'
2020-10-08 21:43:16.408 DEBUG 19656 --- [ restartedMain] .m.m.a.ExceptionHandlerExceptionResolver : ControllerAdvice beans: 0 #ExceptionHandler, 1 ResponseBodyAdvice
2020-10-08 21:43:16.601 INFO 19656 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
2020-10-08 21:43:16.751 INFO 19656 --- [ restartedMain] o.s.s.c.ThreadPoolTaskScheduler : Initializing ExecutorService 'taskScheduler'
2020-10-08 21:43:16.851 INFO 19656 --- [ restartedMain] o.s.i.endpoint.EventDrivenConsumer : Adding {logging-channel-adapter:_org.springframework.integration.errorLogger} as a subscriber to the 'errorChannel' channel
2020-10-08 21:43:16.852 INFO 19656 --- [ restartedMain] o.s.i.channel.PublishSubscribeChannel : Channel 'application.errorChannel' has 1 subscriber(s).
2020-10-08 21:43:16.852 INFO 19656 --- [ restartedMain] o.s.i.endpoint.EventDrivenConsumer : started bean '_org.springframework.integration.errorLogger'
2020-10-08 21:43:16.903 INFO 19656 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2020-10-08 21:43:16.923 INFO 19656 --- [ restartedMain] i.p.start.MyNewProjectApplication : Started MyNewProjectApplication in 3.491 seconds (JVM running for 6.366)
2020-10-08 21:43:20.841 INFO 19656 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2020-10-08 21:43:20.841 INFO 19656 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2020-10-08 21:43:20.841 DEBUG 19656 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Detected StandardServletMultipartResolver
2020-10-08 21:43:20.851 DEBUG 19656 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : enableLoggingRequestDetails='false': request parameters and headers will be masked to prevent unsafe logging of potentially sensitive data
2020-10-08 21:43:20.851 INFO 19656 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 10 ms
2020-10-08 21:43:20.881 DEBUG 19656 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : GET "/home", parameters={}
2020-10-08 21:43:20.896 DEBUG 19656 --- [nio-8080-exec-1] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped to ResourceHttpRequestHandler ["classpath:/META-INF/resources/", "classpath:/resources/", "classpath:/static/", "classpath:/public/", "/"]
2020-10-08 21:43:20.900 DEBUG 19656 --- [nio-8080-exec-1] o.s.w.s.r.ResourceHttpRequestHandler : Resource not found
2020-10-08 21:43:20.901 DEBUG 19656 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed 404 NOT_FOUND
2020-10-08 21:43:20.911 DEBUG 19656 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : "ERROR" dispatch for GET "/error", parameters={}
2020-10-08 21:43:20.914 DEBUG 19656 --- [nio-8080-exec-1] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController#errorHtml(HttpServletRequest, HttpServletResponse)
2020-10-08 21:43:20.960 DEBUG 19656 --- [nio-8080-exec-1] o.s.w.s.v.ContentNegotiatingViewResolver : Selected 'text/html' given [text/html, text/html;q=0.8]
2020-10-08 21:43:20.966 DEBUG 19656 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Exiting from "ERROR" dispatch, status 404
Screen of my browser:
enter image description here
HomeController.java :
package it.progettoThymeleaf.start;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
public class HomeController {
#GetMapping("/home")
public String getHome(Model model) {
model.addAttribute("message", "Benvenuti nel mio nuovo progetto Thymeleaf!");
return "home";
}
}
home.html:
<!DOCTYPE html>
<html xmlns:th="www.thymeleaf.org">
<head>
<meta charset="ISO-8859-1">
<title>Gianluca's New Project</title>
</head>
<body>
<h1 th:text=${message}></h1>
</body>
</html>
Project package explorer screen:
enter image description here
Your namespace in home.html is incomplete http://www.w3.org/1999/xhtml.
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
I tried to create a project on my local and faced the same issue.
I got it resolved by adding an html file under templates folder.
Basically, this is the place where your thymeleaf templates will live. Adding a screenshot.
Add this to your properties file if you want to access home page from /home
server.servlet.context-path=/home

Illegal state exception: Error during attachment using: co.elastic.apm.attach.bytebuddy.agent.ByteBuddyAgent

I just created one application with springboot , used the Elastic APM attacher of APM tool. When i run the apm attacher, it generates error exception as shown below. Code used to generate the error:
package com.howtodoinjava.demo;
import org.springframework.boot.SpringApplication;
import co.elastic.apm.attach.*;
import org.springframework.boot.autoconfigure.SpringBootApplication;
#SpringBootApplication
public class SpringBootDemoApplication {
public static void main(String[] args) {
ElasticApmAttacher.attach();
SpringApplication.run(SpringBootDemoApplication.class, args);
}
}
---------------------------------------------------------------------
IDE: Eclipse
Spring boot
Error exception :
Exception in thread "main" java.lang.IllegalStateException: Error during attachment using: co.elastic.apm.attach.bytebuddy.agent.ByteBuddyAgent$AttachmentProvider$Compound#6debcae2
at co.elastic.apm.attach.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:608)
at co.elastic.apm.attach.bytebuddy.agent.ByteBuddyAgent.attach(ByteBuddyAgent.java:268)
at co.elastic.apm.attach.ElasticApmAttacher.attach(ElasticApmAttacher.java:166)
at co.elastic.apm.attach.ElasticApmAttacher.attach(ElasticApmAttacher.java:120)
at co.elastic.apm.attach.ElasticApmAttacher.attach(ElasticApmAttacher.java:77)
at com.howtodoinjava.demo.SpringBootDemoApplication.main(SpringBootDemoApplication.java:11)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at co.elastic.apm.attach.bytebuddy.agent.Attacher.install(Attacher.java:106)
at co.elastic.apm.attach.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:603)
... 5 more
Caused by: java.lang.NoSuchMethodError: com.sun.jna.Native.load(Ljava/lang/String;Ljava/lang/Class;Ljava/util/Map;)Lcom/sun/jna/Library;
at com.sun.jna.platform.win32.Kernel32.<clinit>(Kernel32.java:43)
at co.elastic.apm.attach.bytebuddy.agent.VirtualMachine$ForHotSpot$Connection$ForJnaWindowsNamedPipe$Factory.connect(VirtualMachine.java:1235)
at co.elastic.apm.attach.bytebuddy.agent.VirtualMachine$ForHotSpot.attach(VirtualMachine.java:256)
at co.elastic.apm.attach.bytebuddy.agent.VirtualMachine$ForHotSpot.attach(VirtualMachine.java:239)
... 11 more
---------------------------
But if I try to run the application commenting the line i.e //ElasticApmAttacher.attach(); from same code, it runs successfully
package com.howtodoinjava.demo;
import org.springframework.boot.SpringApplication;
import co.elastic.apm.attach.*;
import org.springframework.boot.autoconfigure.SpringBootApplication;
#SpringBootApplication
public class SpringBootDemoApplication {
public static void main(String[] args) {
//ElasticApmAttacher.attach();
SpringApplication.run(SpringBootDemoApplication.class, args);
}
}
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.4.0.RELEASE)
2019-12-07 22:58:30.086 INFO 16984 --- [ main] c.h.demo.SpringBootDemoApplication : Starting SpringBootDemoApplication on LP-ArvindK with PID 16984 (C:\Users\arvind.kumar\Downloads\springbootdemo-hello-world-rest\springbootdemo\target\classes started by Arvind.Kumar in C:\Users\arvind.kumar\Downloads\springbootdemo-hello-world-rest\springbootdemo)
2019-12-07 22:58:30.090 INFO 16984 --- [ main] c.h.demo.SpringBootDemoApplication : No active profile set, falling back to default profiles: default
2019-12-07 22:58:30.130 INFO 16984 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#647fd8ce: startup date [Sat Dec 07 22:58:30 IST 2019]; root of context hierarchy
2019-12-07 22:58:31.046 INFO 16984 --- [ main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2019-12-07 22:58:31.107 INFO 16984 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$64c40b86] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-12-07 22:58:31.431 INFO 16984 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8081 (http)
2019-12-07 22:58:31.439 INFO 16984 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat
2019-12-07 22:58:31.439 INFO 16984 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.4
2019-12-07 22:58:31.610 INFO 16984 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2019-12-07 22:58:31.610 INFO 16984 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1484 ms
2019-12-07 22:58:31.734 INFO 16984 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2019-12-07 22:58:31.734 INFO 16984 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2019-12-07 22:58:31.734 INFO 16984 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2019-12-07 22:58:31.734 INFO 16984 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2019-12-07 22:58:31.734 INFO 16984 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2019-12-07 22:58:32.038 INFO 16984 --- [ main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2019-12-07 22:58:32.050 INFO 16984 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2019-12-07 22:58:32.138 INFO 16984 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {5.0.9.Final}
2019-12-07 22:58:32.142 INFO 16984 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2019-12-07 22:58:32.142 INFO 16984 --- [ main] org.hibernate.cfg.Environment : HHH000021: Bytecode provider name : javassist
2019-12-07 22:58:32.230 INFO 16984 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
2019-12-07 22:58:32.350 INFO 16984 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.HSQLDialect
2019-12-07 22:58:32.489 INFO 16984 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000227: Running hbm2ddl schema export
2019-12-07 22:58:32.489 INFO 16984 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000230: Schema export complete
2019-12-07 22:58:32.501 INFO 16984 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2019-12-07 22:58:32.830 INFO 16984 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for #ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#647fd8ce: startup date [Sat Dec 07 22:58:30 IST 2019]; root of context hierarchy
2019-12-07 22:58:32.878 INFO 16984 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/]}" onto public java.util.List<com.howtodoinjava.demo.model.Employee> com.howtodoinjava.demo.controller.EmployeeController.getEmployees()
2019-12-07 22:58:32.878 INFO 16984 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2019-12-07 22:58:32.878 INFO 16984 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2019-12-07 22:58:32.910 INFO 16984 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2019-12-07 22:58:32.910 INFO 16984 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2019-12-07 22:58:32.938 INFO 16984 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2019-12-07 22:58:33.167 INFO 16984 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2019-12-07 22:58:33.205 INFO 16984 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8081 (http)
2019-12-07 22:58:33.209 INFO 16984 --- [ main] c.h.demo.SpringBootDemoApplication : Started SpringBootDemoApplication in 3.365 seconds (JVM running for 4.327)
i am searching for solution but so far clueless. Can someone please suggest how to resolve it
The exception comes from the constructur of the Kernel32 class which is a class of the Maven coordinate net.java.dev.jna:jna-platform which itself depends on net.java.dev.jna:jna. It seems to me like you have to incompatible versions of those dependencies on the class path.
I assume that you use version 4 of JNA core and version 5 of JNA platform. Upgrade the first or downgrade the latter and the error should disappear.

Cannot enable APR Protocol on Embedded Tomcat

I am trying to use the APR protocol in my Spring Boot project.
Till now i have downloaded the tomcat-native library and did what it instructed me to do, which are ./configure , make and make install. After that i copied all libtcnative files with different extensions to /usr/lib. Now Embedded Tomcat has found all tomcat-native files but it is not running tomcat using the APR protocol.
I have configured my project to run in https with a letsencrypt certificate in http/2 and I am using Ubuntu 16.04, Java 1.8.191, Spring Boot 2.0.7. Below is my logtrace when my server starts:
/usr/lib/jvm/java-1.8.0-openjdk-amd64/bin/java -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=44947 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=localhost -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -javaagent:/home/samim/IntalledSoftware/idea-IU-173.4301.25/lib/idea_rt.jar=37149:/home/samim/IntalledSoftware/idea-IU-173.4301.25/bin -Dfile.encoding=UTF-8 -classpath /usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/charsets.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/ext/cldrdata.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/ext/dnsns.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/ext/icedtea-sound.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/ext/jaccess.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/ext/localedata.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/ext/nashorn.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/ext/sunec.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/ext/sunjce_provider.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/ext/sunpkcs11.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/ext/zipfs.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/jce.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/jsse.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/management-agent.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/resources.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/rt.jar:/root/IdeaProjects/templateprocessor/target/classes:/root/.m2/repository/org/springframework/boot/spring-boot-starter-actuator/2.0.7.RELEASE/spring-boot-starter-actuator-2.0.7.RELEASE.jar:/root/.m2/repository/org/springframework/boot/spring-boot-starter/2.0.7.RELEASE/spring-boot-starter-2.0.7.RELEASE.jar:/root/.m2/repository/org/springframework/boot/spring-boot-starter-logging/2.0.7.RELEASE/spring-boot-starter-logging-2.0.7.RELEASE.jar:/root/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar:/root/.m2/repository/ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3.jar:/root/.m2/repository/org/apache/logging/log4j/log4j-to-slf4j/2.10.0/log4j-to-slf4j-2.10.0.jar:/root/.m2/repository/org/apache/logging/log4j/log4j-api/2.10.0/log4j-api-2.10.0.jar:/root/.m2/repository/org/slf4j/jul-to-slf4j/1.7.25/jul-to-slf4j-1.7.25.jar:/root/.m2/repository/javax/annotation/javax.annotation-api/1.3.2/javax.annotation-api-1.3.2.jar:/root/.m2/repository/org/yaml/snakeyaml/1.19/snakeyaml-1.19.jar:/root/.m2/repository/org/springframework/boot/spring-boot-actuator-autoconfigure/2.0.7.RELEASE/spring-boot-actuator-autoconfigure-2.0.7.RELEASE.jar:/root/.m2/repository/org/springframework/boot/spring-boot-actuator/2.0.7.RELEASE/spring-boot-actuator-2.0.7.RELEASE.jar:/root/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.9.7/jackson-databind-2.9.7.jar:/root/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.9.0/jackson-annotations-2.9.0.jar:/root/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.9.7/jackson-core-2.9.7.jar:/root/.m2/repository/org/springframework/spring-context/5.0.11.RELEASE/spring-context-5.0.11.RELEASE.jar:/root/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.9.7/jackson-datatype-jsr310-2.9.7.jar:/root/.m2/repository/io/micrometer/micrometer-core/1.0.8/micrometer-core-1.0.8.jar:/root/.m2/repository/org/hdrhistogram/HdrHistogram/2.1.10/HdrHistogram-2.1.10.jar:/root/.m2/repository/org/latencyutils/LatencyUtils/2.0.3/LatencyUtils-2.0.3.jar:/root/.m2/repository/org/springframework/boot/spring-boot-starter-security/2.0.7.RELEASE/spring-boot-starter-security-2.0.7.RELEASE.jar:/root/.m2/repository/org/springframework/spring-aop/5.0.11.RELEASE/spring-aop-5.0.11.RELEASE.jar:/root/.m2/repository/org/springframework/spring-beans/5.0.11.RELEASE/spring-beans-5.0.11.RELEASE.jar:/root/.m2/repository/org/springframework/security/spring-security-config/5.0.10.RELEASE/spring-security-config-5.0.10.RELEASE.jar:/root/.m2/repository/org/springframework/security/spring-security-web/5.0.10.RELEASE/spring-security-web-5.0.10.RELEASE.jar:/root/.m2/repository/org/springframework/spring-expression/5.0.11.RELEASE/spring-expression-5.0.11.RELEASE.jar:/root/.m2/repository/org/thymeleaf/extras/thymeleaf-extras-springsecurity4/3.0.4.RELEASE/thymeleaf-extras-springsecurity4-3.0.4.RELEASE.jar:/root/.m2/repository/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar:/root/.m2/repository/org/springframework/boot/spring-boot-starter-thymeleaf/2.0.7.RELEASE/spring-boot-starter-thymeleaf-2.0.7.RELEASE.jar:/root/.m2/repository/org/thymeleaf/thymeleaf-spring5/3.0.11.RELEASE/thymeleaf-spring5-3.0.11.RELEASE.jar:/root/.m2/repository/org/thymeleaf/thymeleaf/3.0.11.RELEASE/thymeleaf-3.0.11.RELEASE.jar:/root/.m2/repository/org/attoparser/attoparser/2.0.5.RELEASE/attoparser-2.0.5.RELEASE.jar:/root/.m2/repository/org/unbescape/unbescape/1.1.6.RELEASE/unbescape-1.1.6.RELEASE.jar:/root/.m2/repository/org/thymeleaf/extras/thymeleaf-extras-java8time/3.0.2.RELEASE/thymeleaf-extras-java8time-3.0.2.RELEASE.jar:/root/.m2/repository/org/springframework/boot/spring-boot-starter-web/2.0.7.RELEASE/spring-boot-starter-web-2.0.7.RELEASE.jar:/root/.m2/repository/org/springframework/boot/spring-boot-starter-json/2.0.7.RELEASE/spring-boot-starter-json-2.0.7.RELEASE.jar:/root/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.9.7/jackson-datatype-jdk8-2.9.7.jar:/root/.m2/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.9.7/jackson-module-parameter-names-2.9.7.jar:/root/.m2/repository/org/springframework/boot/spring-boot-starter-tomcat/2.0.7.RELEASE/spring-boot-starter-tomcat-2.0.7.RELEASE.jar:/root/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/8.5.35/tomcat-embed-core-8.5.35.jar:/root/.m2/repository/org/apache/tomcat/embed/tomcat-embed-el/8.5.35/tomcat-embed-el-8.5.35.jar:/root/.m2/repository/org/apache/tomcat/embed/tomcat-embed-websocket/8.5.35/tomcat-embed-websocket-8.5.35.jar:/root/.m2/repository/org/hibernate/validator/hibernate-validator/6.0.13.Final/hibernate-validator-6.0.13.Final.jar:/root/.m2/repository/javax/validation/validation-api/2.0.1.Final/validation-api-2.0.1.Final.jar:/root/.m2/repository/org/jboss/logging/jboss-logging/3.3.2.Final/jboss-logging-3.3.2.Final.jar:/root/.m2/repository/com/fasterxml/classmate/1.3.4/classmate-1.3.4.jar:/root/.m2/repository/org/springframework/spring-web/5.0.11.RELEASE/spring-web-5.0.11.RELEASE.jar:/root/.m2/repository/org/springframework/spring-webmvc/5.0.11.RELEASE/spring-webmvc-5.0.11.RELEASE.jar:/root/.m2/repository/org/springframework/boot/spring-boot-devtools/2.0.7.RELEASE/spring-boot-devtools-2.0.7.RELEASE.jar:/root/.m2/repository/org/springframework/boot/spring-boot/2.0.7.RELEASE/spring-boot-2.0.7.RELEASE.jar:/root/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/2.0.7.RELEASE/spring-boot-autoconfigure-2.0.7.RELEASE.jar:/root/.m2/repository/org/springframework/spring-core/5.0.11.RELEASE/spring-core-5.0.11.RELEASE.jar:/root/.m2/repository/org/springframework/spring-jcl/5.0.11.RELEASE/spring-jcl-5.0.11.RELEASE.jar:/root/.m2/repository/org/springframework/security/spring-security-core/5.0.10.RELEASE/spring-security-core-5.0.10.RELEASE.jar com.siqes.TemplateprocessorApplication
19:23:01.616 [main] DEBUG org.springframework.boot.devtools.settings.DevToolsSettings - Included patterns for restart : []
19:23:01.620 [main] DEBUG org.springframework.boot.devtools.settings.DevToolsSettings - Excluded patterns for restart : [/spring-boot-actuator/target/classes/, /spring-boot-devtools/target/classes/, /spring-boot/target/classes/, /spring-boot-starter-[\w-]+/, /spring-boot-autoconfigure/target/classes/, /spring-boot-starter/target/classes/]
19:23:01.620 [main] DEBUG org.springframework.boot.devtools.restart.ChangeableUrls - Matching URLs for reloading : [file:/root/IdeaProjects/templateprocessor/target/classes/]
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.0.7.RELEASE)
2018-12-26 19:23:02.067 INFO 10929 --- [ restartedMain] com.siqes.TemplateprocessorApplication : Starting TemplateprocessorApplication on dev-76 with PID 10929 (/root/IdeaProjects/templateprocessor/target/classes started by root in /root/IdeaProjects/templateprocessor)
2018-12-26 19:23:02.069 INFO 10929 --- [ restartedMain] com.siqes.TemplateprocessorApplication : No active profile set, falling back to default profiles: default
2018-12-26 19:23:02.158 INFO 10929 --- [ restartedMain] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext#2690e06e: startup date [Wed Dec 26 19:23:02 IST 2018]; root of context hierarchy
2018-12-26 19:23:04.260 INFO 10929 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 443 (https) 80 (http)
2018-12-26 19:23:04.283 INFO 10929 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2018-12-26 19:23:04.284 INFO 10929 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.35
2018-12-26 19:23:04.288 INFO 10929 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener : Loaded APR based Apache Tomcat Native library [1.2.19] using APR version [1.5.2].
2018-12-26 19:23:04.289 INFO 10929 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener : APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
2018-12-26 19:23:04.289 INFO 10929 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener : APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]
2018-12-26 19:23:04.292 INFO 10929 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener : OpenSSL successfully initialized [OpenSSL 1.1.1a 20 Nov 2018]
2018-12-26 19:23:04.356 INFO 10929 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2018-12-26 19:23:04.356 INFO 10929 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 2204 ms
2018-12-26 19:23:04.975 INFO 10929 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2018-12-26 19:23:04.975 INFO 10929 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'webMvcMetricsFilter' to: [/*]
2018-12-26 19:23:04.976 INFO 10929 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2018-12-26 19:23:04.976 INFO 10929 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2018-12-26 19:23:04.976 INFO 10929 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2018-12-26 19:23:04.976 INFO 10929 --- [ost-startStop-1] .s.DelegatingFilterProxyRegistrationBean : Mapping filter: 'springSecurityFilterChain' to: [/*]
2018-12-26 19:23:04.977 INFO 10929 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpTraceFilter' to: [/*]
2018-12-26 19:23:04.977 INFO 10929 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Servlet dispatcherServlet mapped to [/]
2018-12-26 19:23:05.150 INFO 10929 --- [ restartedMain] .s.s.UserDetailsServiceAutoConfiguration :
Using generated security password: 7c0a25e1-aa1f-4b57-884f-94fbd8afc570
2018-12-26 19:23:05.267 INFO 10929 --- [ restartedMain] o.s.s.w.a.c.ChannelProcessingFilter : Validated configuration attributes
2018-12-26 19:23:05.290 INFO 10929 --- [ restartedMain] o.s.s.web.DefaultSecurityFilterChain : Creating filter chain: org.springframework.security.web.util.matcher.AnyRequestMatcher#1, [org.springframework.security.web.access.channel.ChannelProcessingFilter#c0cdb3d, org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter#2b320338, org.springframework.security.web.context.SecurityContextPersistenceFilter#325f68d3, org.springframework.security.web.header.HeaderWriterFilter#48e85931, org.springframework.security.web.authentication.logout.LogoutFilter#240e5c77, org.springframework.security.web.savedrequest.RequestCacheAwareFilter#60808cc4, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter#145d0cc7, org.springframework.security.web.authentication.AnonymousAuthenticationFilter#68485018, org.springframework.security.web.session.SessionManagementFilter#d3c6627, org.springframework.security.web.access.ExceptionTranslationFilter#71d8532b, org.springframework.security.web.access.intercept.FilterSecurityInterceptor#787589ce]
2018-12-26 19:23:05.380 INFO 10929 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-12-26 19:23:05.659 INFO 10929 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for #ControllerAdvice: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext#2690e06e: startup date [Wed Dec 26 19:23:02 IST 2018]; root of context hierarchy
2018-12-26 19:23:05.710 INFO 10929 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/],methods=[GET]}" onto public java.lang.String com.siqes.templateprocessor.controller.MainController.home()
2018-12-26 19:23:05.711 INFO 10929 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/template-processor],methods=[GET]}" onto public java.lang.String com.siqes.templateprocessor.controller.MainController.templateProcessor()
2018-12-26 19:23:05.716 INFO 10929 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2018-12-26 19:23:05.716 INFO 10929 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2018-12-26 19:23:05.741 INFO 10929 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-12-26 19:23:05.741 INFO 10929 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-12-26 19:23:06.038 INFO 10929 --- [ restartedMain] o.s.b.a.e.web.EndpointLinksResolver : Exposing 2 endpoint(s) beneath base path '/actuator'
2018-12-26 19:23:06.048 INFO 10929 --- [ restartedMain] s.b.a.e.w.s.WebMvcEndpointHandlerMapping : Mapped "{[/actuator/health],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map<java.lang.String, java.lang.String>)
2018-12-26 19:23:06.049 INFO 10929 --- [ restartedMain] s.b.a.e.w.s.WebMvcEndpointHandlerMapping : Mapped "{[/actuator/info],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map<java.lang.String, java.lang.String>)
2018-12-26 19:23:06.051 INFO 10929 --- [ restartedMain] s.b.a.e.w.s.WebMvcEndpointHandlerMapping : Mapped "{[/actuator],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto protected java.util.Map<java.lang.String, java.util.Map<java.lang.String, org.springframework.boot.actuate.endpoint.web.Link>> org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping.links(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2018-12-26 19:23:06.071 WARN 10929 --- [ restartedMain] on$ThymeleafSecurityDialectConfiguration : Auto-configuration for thymeleaf-extras-springsecurity4 is deprecated in favour of thymeleaf-extras-springsecurity5
2018-12-26 19:23:06.126 INFO 10929 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
2018-12-26 19:23:06.168 INFO 10929 --- [ restartedMain] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2018-12-26 19:23:06.611 INFO 10929 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 443 (https) 80 (http) with context path ''
2018-12-26 19:23:06.616 INFO 10929 --- [ restartedMain] com.siqes.TemplateprocessorApplication : Started TemplateprocessorApplication in 4.983 seconds (JVM running for 5.92)
2018-12-26 19:23:07.282 INFO 10929 --- [on(4)-127.0.0.1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring FrameworkServlet 'dispatcherServlet'
2018-12-26 19:23:07.282 INFO 10929 --- [on(4)-127.0.0.1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization started
2018-12-26 19:23:07.298 INFO 10929 --- [on(4)-127.0.0.1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization completed in 16 ms
My beans are as follows:
#Configuration
public class ConnectorConfig {
#Bean
public ServletWebServerFactory servletContainer() {
TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory() {
#Override
protected void postProcessContext(Context context) {
SecurityConstraint securityConstraint = new SecurityConstraint();
securityConstraint.setUserConstraint("CONFIDENTIAL");
SecurityCollection collection = new SecurityCollection();
collection.addPattern("/*");
securityConstraint.addCollection(collection);
context.addConstraint(securityConstraint);
}
};
tomcat.addAdditionalTomcatConnectors(redirectConnector());
return tomcat;
}
private Connector redirectConnector() {
Connector connector = new Connector(TomcatServletWebServerFactory.DEFAULT_PROTOCOL);
connector.setScheme("http");
connector.setPort(80);
connector.setSecure(false);
connector.setRedirectPort(443);
return connector;
}
}
I even tried using the AprLifecycleListener like below:
#Bean
public ServletWebServerFactory servletContainer() {
TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory() {
#Override
protected void postProcessContext(Context context) {
SecurityConstraint securityConstraint = new SecurityConstraint();
securityConstraint.setUserConstraint("CONFIDENTIAL");
SecurityCollection collection = new SecurityCollection();
collection.addPattern("/*");
securityConstraint.addCollection(collection);
context.addConstraint(securityConstraint);
}
};
tomcat.addAdditionalTomcatConnectors(redirectConnector());
LifecycleListener aprLifecycleListener = new AprLifecycleListener();
tomcat.setProtocol("org.apache.coyote.http11.Http11AprProtocol");
tomcat.addContextLifecycleListeners(aprLifecycleListener);
return tomcat;
}
But i get error while starting tomcat with the APR:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.0.7.RELEASE)
2018-12-26 20:05:29.201 INFO 11939 --- [ restartedMain] com.siqes.TemplateprocessorApplication : Starting TemplateprocessorApplication on dev-76 with PID 11939 (/root/IdeaProjects/templateprocessor/target/classes started by root in /root/IdeaProjects/templateprocessor)
2018-12-26 20:05:29.203 INFO 11939 --- [ restartedMain] com.siqes.TemplateprocessorApplication : No active profile set, falling back to default profiles: default
2018-12-26 20:05:29.266 INFO 11939 --- [ restartedMain] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext#57b72439: startup date [Wed Dec 26 20:05:29 IST 2018]; root of context hierarchy
2018-12-26 20:05:31.222 WARN 11939 --- [ restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is java.lang.IllegalStateException: To use SSL, the connector's protocol handler must be an AbstractHttp11JsseProtocol subclass
2018-12-26 20:05:31.235 INFO 11939 --- [ restartedMain] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-12-26 20:05:31.244 ERROR 11939 --- [ restartedMain] o.s.boot.SpringApplication : Application run failed
org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is java.lang.IllegalStateException: To use SSL, the connector's protocol handler must be an AbstractHttp11JsseProtocol subclass
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:157) ~[spring-boot-2.0.7.RELEASE.jar:2.0.7.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542) ~[spring-context-5.0.11.RELEASE.jar:5.0.11.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) ~[spring-boot-2.0.7.RELEASE.jar:2.0.7.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) [spring-boot-2.0.7.RELEASE.jar:2.0.7.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:386) [spring-boot-2.0.7.RELEASE.jar:2.0.7.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) [spring-boot-2.0.7.RELEASE.jar:2.0.7.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1242) [spring-boot-2.0.7.RELEASE.jar:2.0.7.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1230) [spring-boot-2.0.7.RELEASE.jar:2.0.7.RELEASE]
at com.siqes.TemplateprocessorApplication.main(TemplateprocessorApplication.java:10) [classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_191]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_191]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_191]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_191]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-2.0.7.RELEASE.jar:2.0.7.RELEASE]
Caused by: java.lang.IllegalStateException: To use SSL, the connector's protocol handler must be an AbstractHttp11JsseProtocol subclass
at org.springframework.util.Assert.state(Assert.java:73) ~[spring-core-5.0.11.RELEASE.jar:5.0.11.RELEASE]
at org.springframework.boot.web.embedded.tomcat.SslConnectorCustomizer.customize(SslConnectorCustomizer.java:55) ~[spring-boot-2.0.7.RELEASE.jar:2.0.7.RELEASE]
at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.customizeSsl(TomcatServletWebServerFactory.java:317) ~[spring-boot-2.0.7.RELEASE.jar:2.0.7.RELEASE]
at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.customizeConnector(TomcatServletWebServerFactory.java:300) ~[spring-boot-2.0.7.RELEASE.jar:2.0.7.RELEASE]
at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:166) ~[spring-boot-2.0.7.RELEASE.jar:2.0.7.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:181) ~[spring-boot-2.0.7.RELEASE.jar:2.0.7.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:154) ~[spring-boot-2.0.7.RELEASE.jar:2.0.7.RELEASE]
... 13 common frames omitted
Process finished with exit code 0
I had to remove some lines as stackoverflow has a limit of 30000 character. I am posting it in a comment. Please Help.

Spring Boot Run failed

I am using Spring to build my application.
I used Spring Initializr to build my project.
I included the following dependencies:-
JPA
h2 (database)
ThymeLeaf templating engine
Spring Actuator
DevTools
Security
I am using IntelliJ IDEA IDE using Gradle build on Windows Machine.
NOTE:- I have not changed gradle(v4.8) build file.
Down below is the result of running SpringBootApplication:-
"C:\Program Files\Java\jdk1.8.0_171\bin\java.exe" -javaagent:C:\Users\ayman\Downloads\Software\IntelliJIdea\lib\idea_rt.jar=61199:C:\Users\E080978\Downloads\Software\IntelliJIdea\bin -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.8.0_171\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_171\jre\lib\rt.jar;C:\Users\E080978\Downloads\Mastercard Image\demo\out\production\classes;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-actuator\2.0.3.RELEASE\d370eeff676d24523ee530f6abc569474d2f9bf9\spring-boot-starter-actuator-2.0.3.RELEASE.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-data-jpa\2.0.3.RELEASE\56c909f49b5385793942158e143187ecc8c7b54a\spring-boot-starter-data-jpa-2.0.3.RELEASE.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-security\2.0.3.RELEASE\67de3ced1ebc68c7bbd9bc2ced390821fa682c2f\spring-boot-starter-security-2.0.3.RELEASE.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-thymeleaf\2.0.3.RELEASE\7a8cf11f5b7faa244e1979df491811bc0c858743\spring-boot-starter-thymeleaf-2.0.3.RELEASE.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-aop\2.0.3.RELEASE\a78c7bc25fd51b217f078421dc40d13ddc3b9f8f\spring-boot-starter-aop-2.0.3.RELEASE.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-jdbc\2.0.3.RELEASE\4f5f3411692a0f5efb60f7f583bdfcf49199a3d4\spring-boot-starter-jdbc-2.0.3.RELEASE.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter\2.0.3.RELEASE\ffaa050dbd36b0441645598f1a7ddaf67fd5e678\spring-boot-starter-2.0.3.RELEASE.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-devtools\2.0.3.RELEASE\478e12e423b45d182a409f12a28fb9f0cddf84bf\spring-boot-devtools-2.0.3.RELEASE.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-actuator-autoconfigure\2.0.3.RELEASE\f3e3392c3e8e2714fc05bbf0f3ee496ad19eedc7\spring-boot-actuator-autoconfigure-2.0.3.RELEASE.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\com.h2database\h2\1.4.197\bb391050048ca8ae3e32451b5a3714ecd3596a46\h2-1.4.197.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\io.micrometer\micrometer-core\1.0.5\c5eaa23f5bb1f0f4b7eb44824093874d0d9165f5\micrometer-core-1.0.5.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\org.hibernate\hibernate-core\5.2.17.Final\f2dc36470e7a2ffcf6106bb1625ecf5b54bb5f65\hibernate-core-5.2.17.Final.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\javax.transaction\javax.transaction-api\1.2\d81aff979d603edd90dcd8db2abc1f4ce6479e3e\javax.transaction-api-1.2.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\org.springframework.data\spring-data-jpa\2.0.8.RELEASE\8b874afd15da2b4d2d9b8431ad2be0c6829e41fe\spring-data-jpa-2.0.8.RELEASE.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\org.springframework\spring-aspects\5.0.7.RELEASE\afd3f7ecb9d7c2cb3160563f9f64b72223bb0265\spring-aspects-5.0.7.RELEASE.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\org.springframework.security\spring-security-config\5.0.6.RELEASE\60367d94d253c82781b7f9abf2294cd0295e1c1\spring-security-config-5.0.6.RELEASE.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\org.springframework.security\spring-security-web\5.0.6.RELEASE\f502d929ee62f5dce0fc942f5a22faa52eaaac34\spring-security-web-5.0.6.RELEASE.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-autoconfigure\2.0.3.RELEASE\11bc4cc96b08fabad2b3186755818fa0b32d83f\spring-boot-autoconfigure-2.0.3.RELEASE.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-actuator\2.0.3.RELEASE\5aa239d8ad6d8130b055caebf44467b9c55d422b\spring-boot-actuator-2.0.3.RELEASE.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot\2.0.3.RELEASE\b874870d915adbc3dd932e19077d3d45c8e54aa0\spring-boot-2.0.3.RELEASE.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\org.springframework.security\spring-security-core\5.0.6.RELEASE\11c0291cc9cda839b7feb52c519f4a35dc6e251b\spring-security-core-5.0.6.RELEASE.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\org.springframework\spring-context\5.0.7.RELEASE\243a23f8968de8754d8199d669780d683ab177bd\spring-context-5.0.7.RELEASE.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\org.springframework\spring-aop\5.0.7.RELEASE\fdd0b6aa3c9c7a188c3bfbf6dfd8d40e843be9ef\spring-aop-5.0.7.RELEASE.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\org.thymeleaf\thymeleaf-spring5\3.0.9.RELEASE\abf84efd83808a70d982d2790f7f3a7bd3a39cf4\thymeleaf-spring5-3.0.9.RELEASE.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\org.thymeleaf.extras\thymeleaf-extras-java8time\3.0.1.RELEASE\d23760d1e53cd70c489ef40dc94ee6bd2371cceb\thymeleaf-extras-java8time-3.0.1.RELEASE.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-logging\2.0.3.RELEASE\7caad34f01d2688919e15e09a90467963e3d5190\spring-boot-starter-logging-2.0.3.RELEASE.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\javax.annotation\javax.annotation-api\1.3.2\934c04d3cfef185a8008e7bf34331b79730a9d43\javax.annotation-api-1.3.2.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\org.springframework\spring-orm\5.0.7.RELEASE\4deed5f4a38d62f9dba7db8e010da8b49e322757\spring-orm-5.0.7.RELEASE.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\org.springframework\spring-jdbc\5.0.7.RELEASE\9c78c6b9a6c603f6589b480e165939cde7bab7f9\spring-jdbc-5.0.7.RELEASE.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\org.springframework.data\spring-data-commons\2.0.8.RELEASE\5c19af63b5acb0eab39066684e813d5ecd9d03b7\spring-data-commons-2.0.8.RELEASE.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\org.springframework\spring-tx\5.0.7.RELEASE\4ca59b21c61162adb146ad1b40c30b60d8dc42b8\spring-tx-5.0.7.RELEASE.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\org.springframework\spring-web\5.0.7.RELEASE\2e04c6c2922fbfa06b5948be14a5782db168b6ec\spring-web-5.0.7.RELEASE.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\org.springframework\spring-beans\5.0.7.RELEASE\c1196cb3e56da83e3c3a02ef323699f4b05feedc\spring-beans-5.0.7.RELEASE.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\org.springframework\spring-expression\5.0.7.RELEASE\ca01fb473f53dd0ee3c85663b26d5dc325602057\spring-expression-5.0.7.RELEASE.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\org.springframework\spring-core\5.0.7.RELEASE\54b731178d81e66eca9623df772ff32718208137\spring-core-5.0.7.RELEASE.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\org.yaml\snakeyaml\1.19\2d998d3d674b172a588e54ab619854d073f555b5\snakeyaml-1.19.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.datatype\jackson-datatype-jsr310\2.9.6\ea54f6193d224e5e5732bbd4262327eb465397c2\jackson-datatype-jsr310-2.9.6.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-databind\2.9.6\cfa4f316351a91bfd95cb0644c6a2c95f52db1fc\jackson-databind-2.9.6.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\org.hdrhistogram\HdrHistogram\2.1.10\9e1ac84eed220281841b75e72fb9de5a297fbf04\HdrHistogram-2.1.10.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\org.latencyutils\LatencyUtils\2.0.3\769c0b82cb2421c8256300e907298a9410a2a3d3\LatencyUtils-2.0.3.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\org.aspectj\aspectjweaver\1.8.13\ad94df2a28d658a40dc27bbaff6a1ce5fbf04e9b\aspectjweaver-1.8.13.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\com.zaxxer\HikariCP\2.7.9\a83113d2c091d0d0f853dad3217bd7df3beb6ae3\HikariCP-2.7.9.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\org.hibernate.common\hibernate-commons-annotations\5.0.1.Final\71e1cff3fcb20d3b3af4f3363c3ddb24d33c6879\hibernate-commons-annotations-5.0.1.Final.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\org.jboss.logging\jboss-logging\3.3.2.Final\3789d00e859632e6c6206adc0c71625559e6e3b0\jboss-logging-3.3.2.Final.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\org.hibernate.javax.persistence\hibernate-jpa-2.1-api\1.0.2.Final\52afb5762c704a6b586e27742470c08f91877fc1\hibernate-jpa-2.1-api-1.0.2.Final.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\org.javassist\javassist\3.22.0-GA\3e83394258ae2089be7219b971ec21a8288528ad\javassist-3.22.0-GA.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\antlr\antlr\2.7.7\83cd2cd674a217ade95a4bb83a8a14f351f48bd0\antlr-2.7.7.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\org.jboss\jandex\2.0.3.Final\bfc4d6257dbff7a33a357f0de116be6ff951d849\jandex-2.0.3.Final.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\com.fasterxml\classmate\1.3.4\3d5f48f10bbe4eb7bd862f10c0583be2e0053c6\classmate-1.3.4.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\dom4j\dom4j\1.6.1\5d3ccc056b6f056dbf0dddfdf43894b9065a8f94\dom4j-1.6.1.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\org.thymeleaf\thymeleaf\3.0.9.RELEASE\64185cca50ac808ad034841c84b4013f955465d2\thymeleaf-3.0.9.RELEASE.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\ch.qos.logback\logback-classic\1.2.3\7c4f3c474fb2c041d8028740440937705ebb473a\logback-classic-1.2.3.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\org.apache.logging.log4j\log4j-to-slf4j\2.10.0\f7e631ccf49cfc0aefa4a2a728da7d374c05bd3c\log4j-to-slf4j-2.10.0.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\org.slf4j\jul-to-slf4j\1.7.25\af5364cd6679bfffb114f0dec8a157aaa283b76\jul-to-slf4j-1.7.25.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\org.slf4j\slf4j-api\1.7.25\da76ca59f6a57ee3102f8f9bd9cee742973efa8a\slf4j-api-1.7.25.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\org.springframework\spring-jcl\5.0.7.RELEASE\699016ddf454c2c167d9f84ae5777eccadf54728\spring-jcl-5.0.7.RELEASE.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-annotations\2.9.0\7c10d545325e3a6e72e06381afe469fd40eb701\jackson-annotations-2.9.0.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-core\2.9.6\4e393793c37c77e042ccc7be5a914ae39251b365\jackson-core-2.9.6.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\org.attoparser\attoparser\2.0.4.RELEASE\5cf02c4d8303a81f0c80971bb1dcd40d3ba96009\attoparser-2.0.4.RELEASE.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\org.unbescape\unbescape\1.1.5.RELEASE\46dc644ea9c234317d926ebac5bf5d8f114dc1ba\unbescape-1.1.5.RELEASE.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\ch.qos.logback\logback-core\1.2.3\864344400c3d4d92dfeb0a305dc87d953677c03c\logback-core-1.2.3.jar;C:\Users\E080978\.gradle\caches\modules-2\files-2.1\org.apache.logging.log4j\log4j-api\2.10.0\fec5797a55b786184a537abd39c3fa1449d752d6\log4j-api-2.10.0.jar" com.mastercard.ayman.imagepackt.ImagePacktApplication
12:37:05.891 [main] DEBUG org.springframework.boot.devtools.settings.DevToolsSettings - Included patterns for restart : []
12:37:05.898 [main] DEBUG org.springframework.boot.devtools.settings.DevToolsSettings - Excluded patterns for restart : [/spring-boot-actuator/target/classes/, /spring-boot-devtools/target/classes/, /spring-boot/target/classes/, /spring-boot-starter-[\w-]+/, /spring-boot-autoconfigure/target/classes/, /spring-boot-starter/target/classes/]
12:37:05.898 [main] DEBUG org.springframework.boot.devtools.restart.ChangeableUrls - Matching URLs for reloading : [file:/C:/Users/E080978/Downloads/Mastercard%20Image/demo/out/production/classes/]
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.0.3.RELEASE)
2018-06-20 12:37:06.301 INFO 23152 --- [ restartedMain] c.m.a.imagepackt.ImagePacktApplication : Starting ImagePacktApplication on GH-6C9HNH2 with PID 23152 (started by E080978 in C:\Users\E080978\Downloads\Mastercard Image\demo)
2018-06-20 12:37:06.302 INFO 23152 --- [ restartedMain] c.m.a.imagepackt.ImagePacktApplication : No active profile set, falling back to default profiles: default
2018-06-20 12:37:06.374 INFO 23152 --- [ restartedMain] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext#17c49070: startup date [Wed Jun 20 12:37:06 IST 2018]; root of context hierarchy
2018-06-20 12:37:07.824 INFO 23152 --- [ restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$b97b663c] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-06-20 12:37:08.184 INFO 23152 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2018-06-20 12:37:08.349 INFO 23152 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2018-06-20 12:37:08.409 INFO 23152 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2018-06-20 12:37:08.431 INFO 23152 --- [ restartedMain] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2018-06-20 12:37:08.523 INFO 23152 --- [ restartedMain] org.hibernate.Version : HHH000412: Hibernate Core {5.2.17.Final}
2018-06-20 12:37:08.524 INFO 23152 --- [ restartedMain] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2018-06-20 12:37:08.566 INFO 23152 --- [ restartedMain] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
2018-06-20 12:37:08.713 INFO 23152 --- [ restartedMain] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
2018-06-20 12:37:09.315 INFO 23152 --- [ restartedMain] o.h.t.schema.internal.SchemaCreatorImpl : HHH000476: Executing import script 'org.hibernate.tool.schema.internal.exec.ScriptSourceInputNonExistentImpl#2c5eb52e'
2018-06-20 12:37:09.319 INFO 23152 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2018-06-20 12:37:10.108 WARN 23152 --- [ restartedMain] ion$DefaultTemplateResolverConfiguration : Cannot find template location: classpath:/templates/ (please add some templates or check your Thymeleaf configuration)
2018-06-20 12:37:10.246 INFO 23152 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
2018-06-20 12:37:10.284 INFO 23152 --- [ restartedMain] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2018-06-20 12:37:10.285 INFO 23152 --- [ restartedMain] o.s.j.e.a.AnnotationMBeanExporter : Bean with name 'dataSource' has been autodetected for JMX exposure
2018-06-20 12:37:10.289 INFO 23152 --- [ restartedMain] o.s.j.e.a.AnnotationMBeanExporter : Located MBean 'dataSource': registering with JMX server as MBean [com.zaxxer.hikari:name=dataSource,type=HikariDataSource]
2018-06-20 12:37:10.302 INFO 23152 --- [ restartedMain] c.m.a.imagepackt.ImagePacktApplication : Started ImagePacktApplication in 4.384 seconds (JVM running for 5.279)
2018-06-20 12:37:10.308 INFO 23152 --- [ Thread-10] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext#17c49070: startup date [Wed Jun 20 12:37:06 IST 2018]; root of context hierarchy
2018-06-20 12:37:10.312 INFO 23152 --- [ Thread-10] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown
2018-06-20 12:37:10.313 INFO 23152 --- [ Thread-10] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans
2018-06-20 12:37:10.314 INFO 23152 --- [ Thread-10] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2018-06-20 12:37:10.315 INFO 23152 --- [ Thread-10] .SchemaDropperImpl$DelayedDropActionImpl : HHH000477: Starting delayed drop of schema as part of SessionFactory shut-down'
2018-06-20 12:37:10.320 WARN 23152 --- [ Thread-10] o.s.b.f.support.DisposableBeanAdapter : Invocation of destroy method failed on bean with name 'inMemoryDatabaseShutdownExecutor': org.h2.jdbc.JdbcSQLException: Database is already closed (to disable automatic closing at VM shutdown, add ";DB_CLOSE_ON_EXIT=FALSE" to the db URL) [90121-197]
2018-06-20 12:37:10.321 INFO 23152 --- [ Thread-10] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
2018-06-20 12:37:10.323 INFO 23152 --- [ Thread-10] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
Process finished with exit code 0
According to me these two lines are the problem:
1.The first line
Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$b97b663c] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-06-20 12:37:08.184 INFO 23152 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource :
2.The second line
2018-06-20 12:37:10.320 WARN 23152 --- [ Thread-10] o.s.b.f.support.DisposableBeanAdapter : Invocation of destroy method failed on bean with name 'inMemoryDatabaseShutdownExecutor': org.h2.jdbc.JdbcSQLException: Database is already closed (to disable automatic closing at VM shutdown, add ";DB_CLOSE_ON_EXIT=FALSE" to the db URL) [90121-197]
I have not done any configuration on the database. Do I need to change database properties for the same?
This is expected. Your app doesn't have any web dependencies, it's simply starting up, running and closing.
Add
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
If you want an embedded container to run.
I should add you will not see this with < 2.0 and those starters, since boot 2.0 and WebFlux Spring boot starter web is no longer a transitive dependency. You must specify it.
... add ";DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE" to the db URL ...
Add to application.properties file:
spring.datasource.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
probably you need to exclude datasource(if you already have your own datasource configured for application) auto configuration in main class.
#SpringBootApplication(exclude = { DataSourceAutoConfiguration.class,
DataSourceTransactionManagerAutoConfiguration.class})

Spring Boot startup slow on Raspberry PI

Using Spring Boot 2 for an IoT application, I notice that the startup time for Spring is disproportionally slow. The platform is a Raspberry PI 2B - of course, this is going to be significantly slower than a PC. For normal code execution I measure a 20x to 50x difference.
Spring boot startup time on my PC (Win10 x64): 5 seconds
Spring boot startup time on the PI (Ubuntu Server, ARM java in docker running a jar): 11 minutes
If I use the highest factor I've ever measured (50x), I would expect to see a startup time of less than half of the current state. So far, I tried:
Excluding dependencies from auto configuration (now minimal with only only spring-boot-starter-web, kotlin, undertow, webflux, reactor and kafka)
Logging on DEBUG to see what was happening during quiet periods (mostly beans being set up, nothing suspicious, though some beans take several seconds to load)
Different docker image for Java on ARM (no effect)
CPU is consistently at 100%, memory is around 20% and there is plenty of disk space
My preliminary conclusion is that loading beans eats all the CPU cycles. I imagine that initializing a bean should not take several seconds, but it does. What could be the bottleneck here? Can I get Spring to load faster in any way?
Here is the first part of the output from a PC:
2018-01-06 13:43:03.462 INFO 9144 --- [ main] c.e.b.BasestationApplicationKt : Starting BasestationApplicationKt on GPC with PID 9144 (C:\Data\Code\app\git\basestation\out\production\classes started by User in C:\Data\Code\app\git)
2018-01-06 13:43:03.471 INFO 9144 --- [ main] c.e.b.BasestationApplicationKt : The following profiles are active: dev
2018-01-06 13:43:03.637 INFO 9144 --- [ main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext#294e5088: startup date [Sat Jan 06 13:43:03 CET 2018]; root of context hierarchy
2018-01-06 13:43:05.578 INFO 9144 --- [ main] org.xnio : XNIO version 3.3.8.Final
2018-01-06 13:43:05.600 INFO 9144 --- [ main] org.xnio.nio : XNIO NIO Implementation Version 3.3.8.Final
2018-01-06 13:43:05.695 WARN 9144 --- [ main] io.undertow.websockets.jsr : UT026009: XNIO worker was not set on WebSocketDeploymentInfo, the default worker will be used
2018-01-06 13:43:05.695 WARN 9144 --- [ main] io.undertow.websockets.jsr : UT026010: Buffer pool was not set on WebSocketDeploymentInfo, the default pool will be used
2018-01-06 13:43:05.721 INFO 9144 --- [ main] io.undertow.servlet : Initializing Spring embedded WebApplicationContext
2018-01-06 13:43:05.722 INFO 9144 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 2088 ms
2018-01-06 13:43:05.851 INFO 9144 --- [ main] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2018-01-06 13:43:05.857 INFO 9144 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2018-01-06 13:43:07.323 INFO 9144 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/],methods=[GET]}" onto public com.app.basestation.model.Message com.app.basestation.BasestationController.home()
2018-01-06 13:43:07.330 INFO 9144 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2018-01-06 13:43:07.349 INFO 9144 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2018-01-06 13:43:07.509 INFO 9144 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for #ControllerAdvice: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext#294e5088: startup date [Sat Jan 06 13:43:03 CET 2018]; root of context hierarchy
2018-01-06 13:43:08.519 INFO 9144 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2018-01-06 13:43:08.553 INFO 9144 --- [ main] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 2147483647
2018-01-06 13:43:08.678 INFO 9144 --- [ main] o.s.b.w.e.u.UndertowServletWebServer : Undertow started on port(s) 11112 (http)
And the output from the PI:
2018-01-06 12:48:41.689 INFO 1 --- [ main] c.e.b.BasestationApplicationKt : Starting BasestationApplicationKt on ubuntu with PID 1 (/app.jar started by root in /)
2018-01-06 12:48:42.019 INFO 1 --- [ main] c.e.b.BasestationApplicationKt : The following profiles are active: prd
2018-01-06 12:48:49.827 INFO 1 --- [ main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext#128c152: startup date [Sat Jan 06 12:48:49 UTC 2018]; root of context hierarchy
2018-01-06 12:54:05.276 INFO 1 --- [ main] org.xnio : XNIO version 3.3.8.Final
2018-01-06 12:54:08.404 INFO 1 --- [ main] org.xnio.nio : XNIO NIO Implementation Version 3.3.8.Final
2018-01-06 12:54:15.847 WARN 1 --- [ main] io.undertow.websockets.jsr : UT026009: XNIO worker was not set on WebSocketDeploymentInfo, the default worker will be used
2018-01-06 12:54:15.852 WARN 1 --- [ main] io.undertow.websockets.jsr : UT026010: Buffer pool was not set on WebSocketDeploymentInfo, the default pool will be used
2018-01-06 12:54:19.930 INFO 1 --- [ main] io.undertow.servlet : Initializing Spring embedded WebApplicationContext
2018-01-06 12:54:19.934 INFO 1 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 330155 ms
2018-01-06 12:54:42.544 INFO 1 --- [ main] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2018-01-06 12:54:43.206 INFO 1 --- [ main] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2018-01-06 12:57:18.683 INFO 1 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/],methods=[GET]}" onto public com.app.basestation.model.Message com.app.basestation.BasestationController.home()
2018-01-06 12:57:19.734 INFO 1 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2018-01-06 12:57:19.758 INFO 1 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2018-01-06 12:57:44.597 INFO 1 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for #ControllerAdvice: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext#128c152: startup date [Sat Jan 06 12:48:49 UTC 2018]; root of context hierarchy
2018-01-06 12:59:36.677 INFO 1 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2018-01-06 12:59:37.807 INFO 1 --- [ main] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 2147483647
2018-01-06 12:59:42.664 INFO 1 --- [ main] o.s.b.w.e.u.UndertowServletWebServer : Undertow started on port(s) 11112 (http)
Update:
For those reading this, I moved back to OpenJDK in 2019 due to the new Oracle policies. What I noticed is that OpenJDK has made significant performance improvements recently. If you use OpenJDK 11 and above, it has similar performance to Oracle JDK and you can easily configure its language level to work with Java 8 code. That said, if this does not work for you, try the below.
I moved to a new image: Oracle JDK instead of OpenJDK as #snodnipper suggested.
There were several things I had to do including installing a more recent version of Java 8 than the one available in the standard repository. This is the Dockerfile that ended up working for me, and now the application starts in 2 minutes.
FROM resin/raspberrypi3-buildpack-deps:jessie-scm
ENV LANG C.UTF-8
ENV JAVA_HOME /usr/lib/jvm/java-8-oracle
RUN ["cross-build-start"]
RUN echo "deb http://archive.raspberrypi.org/debian/ jessie main ui staging" > /etc/apt/sources.list.d/raspi.list
RUN rm -f /usr/bin/entry.sh
RUN wget -qO - http://archive.raspberrypi.org/debian/raspberrypi.gpg.key | apt-key add -
RUN { \
echo '#!/bin/bash'; \
echo 'set -e'; \
echo; \
echo 'dirname "$(dirname "$(readlink -f "$(which javac || which java)")")"'; \
} > /usr/local/bin/docker-java-home && \
chmod +x /usr/local/bin/docker-java-home
RUN apt-key adv --recv-key --keyserver keyserver.ubuntu.com C2518248EEA14886 && \
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" >> /etc/apt/sources.list.d/raspi.list
RUN set -x && \
apt-get update && \
apt-cache madison oracle-java8-installer && \
echo debconf shared/accepted-oracle-license-v1-1 select true | debconf-set-selections && \
apt-get install -y oracle-java8-installer oracle-java8-set-default && \
rm -rf /var/lib/apt/lists/* && \
[ "$JAVA_HOME" = "$(docker-java-home)" ]
RUN [ "cross-build-end" ]
ADD build/libs/app-0.0.1-SNAPSHOT.jar /app.jar
ENV JAVA_OPTS=""
ENTRYPOINT exec java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /app.jar

Resources