Open cdalexndr opened 4 years ago
The problem is that Stagemonitor 0.89.1 depends on version 3.2.4 of Dropwizard Metrics.
Exporting dependencies of a project based on the latest Spring Boot (2.3.1.RELEASE) and Stagemonitor (0.89.1) you can see the following:
compileClasspath - Compile classpath for source set 'main'.
...
+--- org.springframework.boot:spring-boot-starter-amqp -> 2.3.1.RELEASE
| +--- org.springframework.boot:spring-boot-dependencies:2.3.1.RELEASE
| | +--- io.dropwizard.metrics:metrics-annotation:4.1.9 (c)
| | +--- io.dropwizard.metrics:metrics-core:4.1.9 (c)
| | +--- io.dropwizard.metrics:metrics-graphite:4.1.9 (c)
| | +--- io.dropwizard.metrics:metrics-healthchecks:4.1.9 (c)
| | +--- io.dropwizard.metrics:metrics-json:4.1.9 (c)
...
+--- org.stagemonitor:stagemonitor-core:0.89.1
| +--- org.slf4j:slf4j-api:1.7.25 -> 1.7.30
| +--- io.dropwizard.metrics:metrics-core:3.2.4 -> 4.1.9
...
So basically dropwizard libraries are promoted to version 4.1.9 due to the Spring Boot dependencies. Unfortunately Stagemonitor seems not compatible with version 4.x of Dropwizard: the NPE is due to this commit on Dropwizard Metrics 4.1.2.
If you downgrade the dependency to version 4.1.1 using the following Gradle snippet
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'io.dropwizard.metrics') {
details.useVersion "4.1.1"
}
}
}
the NPE disappears but you experience a new error:
15:02:27.391 [main] ERROR org.stagemonitor.core.Stagemonitor - com/codahale/metrics/JmxReporter
java.lang.NoClassDefFoundError: com/codahale/metrics/JmxReporter
at org.stagemonitor.core.CorePlugin.reportToJMX(CorePlugin.java:568)
at org.stagemonitor.core.CorePlugin.registerReporters(CorePlugin.java:514)
at org.stagemonitor.core.CorePlugin.initializePlugin(CorePlugin.java:489)
at org.stagemonitor.core.Stagemonitor.initializePlugin(Stagemonitor.java:184)
at org.stagemonitor.core.Stagemonitor.initializePluginsInOrder(Stagemonitor.java:154)
at org.stagemonitor.core.Stagemonitor.initializePlugins(Stagemonitor.java:140)
at org.stagemonitor.core.Stagemonitor.start(Stagemonitor.java:101)
at org.stagemonitor.core.Stagemonitor.doStartMonitoring(Stagemonitor.java:89)
at org.stagemonitor.core.Stagemonitor.startMonitoring(Stagemonitor.java:79)
at org.stagemonitor.core.Stagemonitor.reset(Stagemonitor.java:316)
at org.stagemonitor.core.Stagemonitor.reset(Stagemonitor.java:297)
at org.stagemonitor.core.Stagemonitor.init(Stagemonitor.java:58)
This is due to a rename of the package where the Dropwizard Metrics JmxReporter class is included.
Finally you can downgrade Dropwizard Metrics to version 3.2.4
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'io.dropwizard.metrics') {
details.useVersion "3.2.4"
}
}
}
In that case, the application starts. Not sure if Stagemonitor works correctly and/or how the Spring Boot application is affected by the downgrade of Dropwizard Metrics.
Stagemonitor 0.89.1 Spring Boot 2.3.0.RELEASE Gradle 6.4.1
Stagemonitor is initilialized with: