44522

Prometheus config doesn't work with Spring boot 2.3.0: ClassNotFoundException: io.micrometer.pr

<h3>Question</h3>

Application was working correctly with version 2.2.6 but as the application is upgraded to latest version of spring boot 2.3.0 it stopped working and fails during startup.

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]

Can see below class not found exception at the bottom of start trace.


<h3>Answer1:</h3>

In your particular case the micrometer-registry-prometheus must be in-line with spring boot's micrometer-core's version. It is 1.5.1 because Spring Boot (Actuator) pulls that dependency in with version 2.3.0.

implementation group: 'io.micrometer', name: 'micrometer-registry-prometheus', version: '1.5.1'
<h3>Answer2:</h3>

When look at the partial logfile you included, it seems to me that multiple dependencies are not all there or working correctly. Please see the Spring Boot recommendations for using a dependency manager: https://docs.spring.io/spring-boot/docs/current/reference/html/using-spring-boot.html#using-boot-build-systems

When upgrading, it is always useful to check the releasenotes/changelog between versions.

<ul><li>

Release notes for 2.3: https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.3-Release-Notes

</li> <li>

Changelog for 2.2.7 to 2.3.0 see: https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.3.0-Configuration-Changelog

</li> </ul>

If you require more help, please provide information about your configuration;

<ol><li>your pom-file(s) (or other dependency management file)</li> <li>the 'prometheus configuration' that you think is causing the issues</li> </ol>

来源:https://stackoverflow.com/questions/61908419/prometheus-config-doesnt-work-with-spring-boot-2-3-0-classnotfoundexception-i

Recommend

  • Prometheus config doesn't work with Spring boot 2.3.0: ClassNotFoundException: io.micrometer.pr
  • Prometheus config doesn't work with Spring boot 2.3.0: ClassNotFoundException: io.micrometer.pr
  • Prometheus config doesn't work with Spring boot 2.3.0: ClassNotFoundException: io.micrometer.pr
  • Prometheus config doesn't work with Spring boot 2.3.0: ClassNotFoundException: io.micrometer.pr
  • C# Object containing datetime and specific cultureinfo to be fully compatible with Excel datetime ce
  • Yii 2.0 How to extend Core Classes
  • Multiple definitions of a non-template class vs. a template class
  • Angular2. Map http response to concrete object instance
  • Displaying ® symbol in Silverlight
  • Destructure object parameter, but also have reference to the parameter as an object? [duplicate]
  • Swipe Left/Right on collectionView not called while scrolling vertically
  • Strange LINQ to SQL .Union() error
  • Files.size() implementation in Java 7
  • jQuery fade making page jump
  • How do I register a new NuGet package source with dotnet CLI on Ubuntu 14.04?
  • Is there a way to automatically reload Supervisor processes?
  • Make a td fixed size (width,height) while rest of td's can expand
  • Read Existing Avro File and Send to Kafka
  • How to resolve Phonegap error while Building the app
  • Running into Typescript state type mismatch error inside of Redux store file
  • Cannot get date from google sheet filled by google forms
  • Bind a function to multiple dynamically created buttons in kivy?
  • R to BigQuery Data Upload Error
  • Tensorflow transform on beams with flink runner
  • Instagram Authentification with python and requests
  • PHPMailer do not work properly sometimes on gmail port 465 or 587 on localhost
  • Sending Objects over Java Socket really slow
  • Comparing a large set of images by content
  • What is the purpose of set clock skew in wcf security mode settings
  • What is need of Assign/Deassign in Verilog?
  • Google Geocoding API limit exceeded on cell network, but not on wifi
  • Background beacon detection and Notification (Both iOS and Android) for Eddystone beacon?
  • How to move to lines with the same indentation in Visual Studio Code
  • Firestore: Version history of documents
  • flex tree gets chopped even after using scroll bar
  • Can a PHP script be scheduled to run at a specific time or after a specific amount of time has expir