首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >(spring,micrometer+prometheus) NoSuchMethodError - AbstractTimer.<init>

(spring,micrometer+prometheus) NoSuchMethodError - AbstractTimer.<init>
EN

Stack Overflow用户
提问于 2018-06-22 00:55:57
回答 1查看 3.8K关注 0票数 0

在这个问题上我已经挠头好一阵子了。我有一个错误,这个错误是从我的JSON后面的端点中泄漏出来的。

对于每个请求,原始JSON都会在其末尾显示以下消息:

代码语言:javascript
复制
[{"xd":"0"}]{"error":"OK","message":"io.micrometer.core.instrument.AbstractTimer.<init>(Lio/micrometer/core/instrument/Meter$Id;Lio/micrometer/core/instrument/Clock;Lio/micrometer/core/instrument/distribution/DistributionStatisticConfig;Lio/micrometer/core/instrument/distribution/pause/PauseDetector;Ljava/util/concurrent/TimeUnit;Z)V","path":"/avgSpeed","status":200,"timestamp":"2018-06-21T16:40:31.639+0000"}

我有一个springboot应用程序设置用来监视普罗米修斯...我在另一个项目中使用了这个模板,它没有给我带来任何问题。我不确定是什么改变了。

老实说,我不知道该怎么调试这类东西……

这是一个部分堆栈跟踪(它非常长,可以包含请求的全部内容)。[http-nio-8080-exec-2] default 2018-06-21 12:40:31,634 ERROR o.a.c.c.C.[.[.[.[dispatcherServlet]:182 - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Filter execution threw an exception] with root cause java.lang.NoSuchMethodError: io.micrometer.core.instrument.AbstractTimer.(Lio/micrometer/core/instrument/Meter$Id;Lio/micrometer/core/instrument/Clock;Lio/micrometer/core/instrument/distribution/DistributionStatisticConfig;Lio/micrometer/core/instrument/distribution/pause/PauseDetector;Ljava/util/concurrent/TimeUnit;Z)V at io.micrometer.prometheus.PrometheusTimer.(PrometheusTimer.java:40) at io.micrometer.prometheus.PrometheusMeterRegistry.newTimer(PrometheusMeterRegistry.java:161) at io.micrometer.core.instrument.MeterRegistry.lambda$timer$2(MeterRegistry.java:255) at io.micrometer.core.instrument.MeterRegistry.getOrCreateMeter(MeterRegistry.java:561) at io.micrometer.core.instrument.MeterRegistry.registerMeterIfNecessary(MeterRegistry.java:537) at io.micrometer.core.instrument.MeterRegistry.timer(MeterRegistry.java:253) at io.micrometer.core.instrument.Timer$Builder.register(Timer.java:420) at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.stop(WebMvcMetricsFilter.java:237) at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.record(WebMvcMetricsFilter.java:228) at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:166) at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:126) at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:111) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

以下是我的依赖项:

代码语言:javascript
复制
<dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <version>2.0.0.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
            <version>2.0.0.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <version>2.0.0.RELEASE</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</artifactId>
            <version>2.0.0.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>42.2.2</version>
        </dependency>
        <!-- json utilities -->
        <dependency>
            <groupId>com.googlecode.json-simple</groupId>
            <artifactId>json-simple</artifactId>
            <version>1.1.1</version>
        </dependency>
        <!-- for exposing endpoints / prometheus+grafana container -->
        <dependency>
            <groupId>io.micrometer</groupId>
            <artifactId>micrometer-registry-prometheus</artifactId>
            <version>1.0.5</version>
        </dependency>
        <!-- for logback evaluator -->
        <dependency>
            <groupId>org.codehaus.janino</groupId>
            <artifactId>janino</artifactId>
            <version>3.0.8</version>
        </dependency>
    </dependencies>
EN

回答 1

Stack Overflow用户

发布于 2018-06-22 01:05:25

我不知道这是如何改变的,但我注意到我的配套服务正在使用2.0.2.RELEASE用于spring-boot-starter-actuator,1.0.4用于micrometer registry-prometheus。

我更改了我的pom以匹配这些版本,问题就消失了。

错误警报,抱歉!

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50973863

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档