Skip to content

spring-boot-starter-actuator needs a newer version of micrometer-core #28929

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
SingingBush opened this issue Dec 8, 2021 · 10 comments
Closed
Labels
status: invalid An issue that we don't feel is valid

Comments

@SingingBush
Copy link

SingingBush commented Dec 8, 2021

Due to changes in micrometer-core, spring-boot-starter-actuator was updated in issue #27688 to handle the fact that micrometer have changed the package that DiskSpaceMetrics is in (it's now in io.micrometer.core.instrument.binder.system.DiskSpaceMetrics).

The problem is that micrometer-core did that change in the 1.8.* versions but spring-boot-starter-actuator (2.6.1) is pulling in the older 1.7.3 version of micrometer-core which has that class in the old package.

This results in a java.lang.NoClassDefFoundError when initialising the SimpleMetricsExportAutoConfiguration bean.

I was able to work around this problem locally by adding an explicit dependency to micrometer-core 1.8.1 in my pom:

    <dependency>
        <groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>
    <dependency>
        <groupId>io.micrometer</groupId>
        <artifactId>micrometer-core</artifactId>
        <version>1.8.1</version>
    </dependency>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Dec 8, 2021
@wilkinsona
Copy link
Member

Spring Boot 2.6 should use Micrometer 1.8 by default. Can you please provide a minimal example that shows 1.7.3 being used?

@wilkinsona wilkinsona added the status: waiting-for-feedback We need additional information before we can continue label Dec 8, 2021
@antti-markus-cko
Copy link

Spring Boot 2.6.1 uses Micrometer 1.8.0 by default - https://github.com/antti-markus-cko/issuedemo

./gradlew dependencyinsight --dependency micrometer
gives

> Task :dependencyInsight
io.micrometer:micrometer-core:1.8.0 (selected by rule)
   variant "compile" [
      org.gradle.status              = release (not requested)
      org.gradle.usage               = java-api
      org.gradle.libraryelements     = jar (compatible with: classes)
      org.gradle.category            = library

      Requested attributes not found in the selected variant:
         org.gradle.dependency.bundling = external
         org.gradle.jvm.environment     = standard-jvm
         org.gradle.jvm.version         = 17
   ]

io.micrometer:micrometer-core:1.8.0
\--- org.springframework.boot:spring-boot-starter-actuator:2.6.1
     \--- compileClasspath (requested org.springframework.boot:spring-boot-starter-actuator)

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Dec 9, 2021
@bclozel bclozel added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels Dec 9, 2021
@SingingBush
Copy link
Author

that's weird, when I do mvn dependency:tree the only dependency pulling in micrometer-core is spring-boot-starter-actuator and the version is 1.7.3:

[INFO] +- org.springframework.boot:spring-boot-starter-actuator:jar:2.6.1:compile
[INFO] |  +- org.springframework.boot:spring-boot-actuator-autoconfigure:jar:2.6.1:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-actuator:jar:2.6.1:compile
[INFO] |  |  \- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.12.5:compile
[INFO] |  \- io.micrometer:micrometer-core:jar:1.7.3:compile
[INFO] |     +- org.hdrhistogram:HdrHistogram:jar:2.1.12:compile
[INFO] |     \- org.latencyutils:LatencyUtils:jar:2.0.3:runtime

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Dec 13, 2021
@snicoll
Copy link
Member

snicoll commented Dec 13, 2021

@SingingBush That doesn't mean anything if the version was forced by some dependency management in your project. As Andy requested, please share a small sample we can run ourselves that reproduces this.

@snicoll snicoll added status: waiting-for-feedback We need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels Dec 13, 2021
@spring-projects-issues
Copy link
Collaborator

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

@spring-projects-issues spring-projects-issues added the status: feedback-reminder We've sent a reminder that we need additional information before we can continue label Dec 20, 2021
@Killianoc
Copy link

I had this same issue and as @snicoll said it was due to a version being forced by dependency management. In my case it was "azure-spring-boot-bom:3.11.0" forcing version 1.7.3 of micrometer-core.

As OP said, either directly importing micrometer-core will fix this, or else you can exclude it from the direct dependencies (unfortunately I couldn't exclude it at maven dependency management level as Maven doesn't like that, at least at my version of it)

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue status: feedback-reminder We've sent a reminder that we need additional information before we can continue labels Dec 21, 2021
@snicoll
Copy link
Member

snicoll commented Dec 21, 2021

@Killianoc than you for bringing this to my attention. I've reported the issue to Azure.

@snicoll snicoll added status: waiting-for-feedback We need additional information before we can continue status: feedback-reminder We've sent a reminder that we need additional information before we can continue and removed status: feedback-provided Feedback has been provided labels Dec 21, 2021
@snicoll
Copy link
Member

snicoll commented Jan 3, 2022

It's been a while and with a lack of a repro that showcases the problem, I am going to close this now.

@snicoll snicoll closed this as completed Jan 3, 2022
@snicoll snicoll removed status: waiting-for-feedback We need additional information before we can continue status: waiting-for-triage An issue we've not yet triaged labels Jan 3, 2022
@snicoll snicoll added status: invalid An issue that we don't feel is valid and removed status: feedback-reminder We've sent a reminder that we need additional information before we can continue labels Jan 3, 2022
@sandy11apr
Copy link

sandy11apr commented Jun 8, 2022

@snicoll @SingingBush What is the solution I have the same problem.

[INFO] +- org.springframework.boot:spring-boot-starter-actuator:jar:2.6.6:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter:jar:2.6.6:compile
[INFO] |  |  +- org.springframework.boot:spring-boot:jar:2.6.6:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-autoconfigure:jar:2.6.6:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-starter-logging:jar:2.6.6:compile
[INFO] |  |  |  +- ch.qos.logback:logback-classic:jar:1.2.11:compile
[INFO] |  |  |  |  \- ch.qos.logback:logback-core:jar:1.2.11:compile
[INFO] |  |  |  \- org.slf4j:jul-to-slf4j:jar:1.7.36:compile
[INFO] |  |  +- jakarta.annotation:jakarta.annotation-api:jar:1.3.5:compile
[INFO] |  |  \- org.yaml:snakeyaml:jar:1.26:compile
[INFO] |  +- org.springframework.boot:spring-boot-actuator-autoconfigure:jar:2.6.6:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-actuator:jar:2.6.6:compile
[INFO] |  |  \- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.13.2:compile
[INFO] |  **\- io.micrometer:micrometer-core:jar:1.6.2:compile**
[INFO] |     +- org.hdrhistogram:HdrHistogram:jar:2.1.12:compile
[INFO] |     \- org.latencyutils:LatencyUtils:jar:2.0.3:runtime

@scottfrederick
Copy link
Contributor

@sandy11apr It's likely that dependency management in your project is overriding the version of micrometer-core that is managed by Spring Boot. We can't tell what that is just from the dependency graph, we'd need to see a sample project to provide more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

9 participants