Closed DavideRossi closed 1 month ago
May be your application is picking up an older micrometer via a difference dependency route. The maven resolution rule is "least depth" and not version resolving.
Micrometer 1.12.5 to 1.13.0 made a packing change: This happened at https://github.com/apache/jena/pull/2483/files
io.micrometer.prometheus
-> io.micrometer.prometheusmetrics
https://github.com/micrometer-metrics/micrometer/wiki/1.13-Migration-Guide
That's consistent with:
java.lang.NoClassDefFoundError: io/micrometer/prometheusmetrics/PrometheusMeterRegistry
means Jena was compiled against the new package but at runtime it was not found which would be the case if a different micrometer version is being pickjd up.
See what mvn dependency:tree
says for your application.
jena-fuseki-main
on its own is (current development code base - 1.13.3 is latest micrometer from 1.13.0.
[INFO] --- dependency:3.7.1:tree (default-cli) @ jena-fuseki-main ---
[INFO] org.apache.jena:jena-fuseki-main:jar:5.2.0-SNAPSHOT
[INFO] +- org.apache.jena:jena-fuseki-core:jar:5.2.0-SNAPSHOT:compile
...
[INFO] | +- io.micrometer:micrometer-core:jar:1.13.3:compile
[INFO] | | +- io.micrometer:micrometer-commons:jar:1.13.3:compile
[INFO] | | +- io.micrometer:micrometer-observation:jar:1.13.3:compile
[INFO] | | +- org.hdrhistogram:HdrHistogram:jar:2.2.2:runtime
[INFO] | | \- org.latencyutils:LatencyUtils:jar:2.0.3:runtime
[INFO] | \- io.micrometer:micrometer-registry-prometheus:jar:1.13.3:compile
[INFO] | +- io.prometheus:prometheus-metrics-core:jar:1.2.1:compile
[INFO] | | +- io.prometheus:prometheus-metrics-model:jar:1.2.1:compile
[INFO] | | \- io.prometheus:prometheus-metrics-config:jar:1.2.1:compile
[INFO] | +- io.prometheus:prometheus-metrics-tracer-common:jar:1.2.1:compile
[INFO] | \- io.prometheus:prometheus-metrics-exposition-formats:jar:1.2.1:runtime
[INFO] | \- io.prometheus:prometheus-metrics-shaded-protobuf:jar:1.2.1:runtime
Yup, it's a problem with clashing prometheus versions between fuseki and helidon's metrics provider (the latter depending on io.micrometer:micrometer-core:jar:1.11.3
.
Given the relative ease of this happening with many other setups, wouldn't it be a reasonable solution making the prometheus dep optional and put it in a different artifact (something like fuseki-prometheus
)?
It is a nuisance.
We could make it optional and disable Fuseki metrics. If we added an artifact then we'd end up having to keep providing that artifact. Dropping an artifact would break downstream uses.
While it manifests as a java class problem, it is no different really to any other changes between versions.
Suppose 1.11.3 has a NPE and 1.13.x has fixed it. You'll still get the NPE. Or if 1.11.3 gave different answers to 1.13.x - you'd still get wrong answers.
Can you <exclusion>
it from Helidon, or add a dependency in your POM for 1.13.x? That way, your app will use a Fuseki compatible one, or your choice, and it should be compatible with Helidon if it is semantic versioning.
Adding a dependency for exactly the version you want seems to be a common way round these multiple version inclusions.
No semantic versioning (see https://github.com/micrometer-metrics/micrometer/wiki/1.13-Migration-Guide API changes/PrometheusMeterRegistry), the guys at micrometer like to change the API across minor versions...
For Jena, we haven't encountered much change across versions. The use of micrometer/prometheus is not complicated.
Adding a dependency for exactly the version, or greater, should resolve the issue for you, and it is the one that can be undone without any other disturbance.
Version
5.1.0
What happened?
I have a Helidon MP-based app that uses an embedded Fuseki instance. My
pom.xml
contains:where
jena.version
is5.1.0
. As soon as my code executesDatasetFactory.createTxnMem()
it crashes with ajava.lang.NoClassDefFoundError: io/micrometer/prometheusmetrics/PrometheusMeterRegistry
exception. The code works just fine with previous Jena/Fuseki versions. Maybe a missing Prometheus dependency?Relevant output and stacktrace
Are you interested in making a pull request?
None