I used spring boot 1.5.13.RELEASE, and import prometheus dependency to exposure jmx endpoint
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient_spring_boot</artifactId>
<version>0.1.0</version>
</dependency>
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient_hotspot</artifactId>
<version>0.1.0</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
</exclusion>
</exclusions>
</dependency>
My server is
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId>
</dependency>
And my jvm is openj9-jdk8
When i start up my application locally, it all right. But if i put it to my production env, it will cost long time to start up (the test env is fast, only the production slow)
And i check the start up log:
2023-03-02 18:19:34,639 [12df3dc7-9cbe-400e-8b47-73db244becc3] INFO [org.springframework.jmx.export.annotation.AnnotationMBeanExporter] [MBeanExporter.java:679] [trace=,span=] - Located managed bean 'refreshEndpoint': registering with JMX server as MBean [org.springframework.cloud.endpoint:name=refreshEndpoint,type=RefreshEndpoint]
2023-03-02 18:19:34,640 [12df3dc7-9cbe-400e-8b47-73db244becc3] INFO [org.springframework.boot.actuate.endpoint.jmx.EndpointMBeanExporter] [MBeanExporter.java:431] [trace=,span=] - Registering beans for JMX exposure on startup
2023-03-02 18:22:01,205 [12df3dc7-9cbe-400e-8b47-73db244becc3] INFO [org.springframework.context.support.DefaultLifecycleProcessor] [DefaultLifecycleProcessor.java:341] [trace=,span=] - Starting beans in phase 0
2023-03-02 18:22:01,211 [12df3dc7-9cbe-400e-8b47-73db244becc3] INFO [org.springframework.boot.actuate.endpoint.jmx.EndpointMBeanExporter] [MBeanExporter.java:679] [trace=,span=] - Located managed bean 'prometheusEndpoint': registering with JMX server as MBean [org.springframework.boot:type=Endpoint,name=prometheusEndpoint]
2023-03-02 18:22:01,224 [12df3dc7-9cbe-400e-8b47-73db244becc3] INFO [org.springframework.boot.actuate.endpoint.jmx.EndpointMBeanExporter] [MBeanExporter.java:679] [trace=,span=] - Located managed bean 'healthEndpoint': registering with JMX server as MBean [org.springframework.boot:type=Endpoint,name=healthEndpoint]
2023-03-02 18:22:01,511 [12df3dc7-9cbe-400e-8b47-73db244becc3] INFO [org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainer] [UndertowEmbeddedServletContainer.java:160] [trace=,span=] - Undertow started on port(s) 8080 (http)
I found it will cost more than 2 minutes after [org.springframework.boot.actuate.endpoint.jmx.EndpointMBeanExporter] [MBeanExporter.java:431] [trace=,span=] - Registering beans for JMX exposure on startup.
It's really strange, why?
Comment From: wilkinsona
Support for Spring Boot 1.5 ended 4 years ago so we're unable to help you here. You may want to take some thread dumps during the 2-minute period to see what's happening.