spring-projects / spring-projects/spring-boot

Check if it's possible to start Spring Boot on a JVM that doesn't have JMX

Open
#20,959 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: enhancement
Dominant language
Java
Stars
81.5k
Forks
42.7k
Avg merge
2d 4h
Merged PRs (30d)
65

Description

If you run in a restricted JVM that has no JMX, Micrometer falls in a heap:

Caused by: java.lang.NoClassDefFoundError: Could not initialize class sun.management.ManagementFactoryHelper
	at java.lang.management.ManagementFactory.getMemoryPoolMXBeans(ManagementFactory.java:387) ~[na:1.8.0_102-internal]
	at io.micrometer.core.instrument.binder.jvm.JvmGcMetrics.<init>(JvmGcMetrics.java:76) ~[micrometer-core-1.3.2.jar!/:1.3.2]
	at io.micrometer.core.instrument.binder.jvm.JvmGcMetrics.<init>(JvmGcMetrics.java:72) ~[micrometer-core-1.3.2.jar!/:1.3.2]
	at org.springframework.boot.actuate.autoconfigure.metrics.JvmMetricsAutoConfiguration.jvmGcMetrics(JvmMetricsAutoConfiguration.java:48) ~[spring-boot-actuator-autoconfigure-2.2.4.RELEASE.jar!/:2.2.4.RELEASE]

Seems like we could be more defensive, but this is probably not the end of the problem. E.g. I found (from running the Petlinic in Tiny Core Linux) that eh-cache fails in the same way. Also webjars locator has an out of date dependency on the classgraph dependency, and that fails unless you update it.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the stack trace through io.micrometer.core.instrument.binder.jvm.JvmGcMetrics and org.springframework.boot.actuate.autoconfigure.metrics.JvmMetricsAutoConfiguration, then reproduce startup on a JVM without JMX. Investigate the related eh-cache and webjars locator failures mentioned in the issue, and define done as establishing the supported behavior and affected startup paths.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring-boot
Domain
backend, observability
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.