You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

启用DropwizardMetrics后运行Vertx代码报ClassNotFoundException错误求助

Fixing java.lang.ClassNotFoundException: io.vertx.core.spi.metrics.PoolMetrics in Vert.x Metrics Setup

Hey there, I’ve run into this exact issue before when setting up Vert.x with Dropwizard metrics! The problem boils down to missing a critical dependency that provides the metrics SPI implementation your code is trying to use.

What’s causing this?

When you enable DropwizardMetricsOptions in your Vert.x setup, you’re telling Vert.x to use the Dropwizard metrics integration—but your project doesn’t include the actual module that implements those metrics interfaces (like PoolMetrics). Without that module, the JVM can’t find the required class, hence the ClassNotFoundException.

How to fix it

You just need to add the vertx-dropwizard-metrics dependency to your project, matching your Vert.x version. Here’s how to do it for the most common build tools:

Maven (add to your pom.xml)

<dependency>
  <groupId>io.vertx</groupId>
  <artifactId>vertx-dropwizard-metrics</artifactId>
  <version>your-vertx-version</version> <!-- e.g., 4.5.1 -->
</dependency>

Gradle

For Groovy DSL (add to build.gradle):

implementation 'io.vertx:vertx-dropwizard-metrics:your-vertx-version'

For Kotlin DSL (add to build.gradle.kts):

implementation("io.vertx:vertx-dropwizard-metrics:your-vertx-version")

Important note

Make sure the version of vertx-dropwizard-metrics matches exactly with the version of Vert.x core you’re using in your project. Version mismatches can lead to other unexpected errors!

Once you add this dependency and rebuild your project, the ClassNotFoundException should disappear, and your metrics setup should work as expected.

内容的提问来源于stack exchange,提问作者eason

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.22 09:08:24