普罗米修斯配置在Spring boot 2.3.0中无法使用。ClassNotFoundException: io.micrometer.prometheus.HistogramFlavor

问题描述 投票:0回答:1

应用程序在2.2.6版本时工作正常,但当应用程序升级到最新的spring boot 2.3.0版本时,它停止工作并在启动时失败。

2020-05-20T08:43:04.408+01:00 [APP/PROC/WEB/0] [OUT] 2020-05-20 07:43:04.407 ERROR 15 --- [ main] o.s.b.web.embedded.tomcat.TomcatStarter : Error starting Tomcat context. Exception: org.springframework.beans.factory.UnsatisfiedDependencyException. Message: Error creating bean with name 'webMvcMetricsFilter' defined in class path resource [org/springframework/boot/actuate/autoconfigure/metrics/web/servlet/WebMvcMetricsAutoConfiguration.class]: Unsatisfied dependency expressed through method 'webMvcMetricsFilter' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'compositeMeterRegistry' defined in class path resource [org/springframework/boot/actuate/autoconfigure/metrics/CompositeMeterRegistryConfiguration.class]: Unsatisfied dependency expressed through method 'compositeMeterRegistry' parameter 1; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'prometheusMeterRegistry' defined in class path resource [org/springframework/boot/actuate/autoconfigure/metrics/export/prometheus/PrometheusMetricsExportAutoConfiguration.class]: Unsatisfied dependency expressed through method 'prometheusMeterRegistry' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'prometheusConfig' defined in class path resource [org/springframework/boot/actuate/autoconfigure/metrics/export/prometheus/PrometheusMetricsExportAutoConfiguration.class]: Unsatisfied dependency expressed through method 'prometheusConfig' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'management.metrics.export.prometheus-org.springframework.boot.actuate.autoconfigure.metrics.export.prometheus.PrometheusProperties': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.springframework.boot.actuate.autoconfigure.metrics.export.prometheus.PrometheusProperties] from ClassLoader [org.springframework.boot.loader.LaunchedURLClassLoader@4f3f5b24]

在启动跟踪的底部可以看到下面的类未找到异常。enter image description here

prometheus spring-boot-actuator spring-boot-2
1个回答
3
投票

在你的特殊情况下 千分尺-注册-普罗米修斯(prometheus) 必须与弹簧套的千分表芯版本一致。它是 1.5.1 因为Spring Boot (Actuator)在2.3.0版本时就把这个依赖关系拉进来了。

  implementation group: 'io.micrometer', name: 'micrometer-registry-prometheus', version: '1.5.1'

0
投票

当查看你所包含的部分日志文件时,在我看来,多个依赖关系并没有全部存在或正确工作。请参阅Spring Boot关于使用依赖管理器的建议。https:/docs.spring.iospring-bootdocscurrentreferencehtmlusing-spring-boot.html#using-boot-build-systems。

当升级时,检查不同版本之间的releasenoteschangelog总是很有用的。

如果您需要更多帮助,请提供有关您的配置信息。

  1. 您的 pom 文件(或其他依赖性管理文件)。
  2. 您认为导致问题的 "prometheus配置"。
© www.soinside.com 2019 - 2024. All rights reserved.