{"record":{"id":"a9106cfa07e83798","repo":"apache/iceberg","slug":"cannot-load-dropwizard-metrics-is-org-apache-flin","errorCode":null,"errorMessage":"Cannot load Dropwizard metrics; is org.apache.flink:flink-metrics-dropwizard on the classpath?","messagePattern":"Cannot load Dropwizard metrics; is org\\.apache\\.flink:flink-metrics-dropwizard on the classpath\\?","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"flink/v1.20/flink/src/main/java/org/apache/iceberg/flink/sink/IcebergStreamWriterMetrics.java","lineNumber":150,"sourceCode":"    try {\n      Class<?> reservoirInterface =\n          DynClasses.builder().impl(\"com.codahale.metrics.Reservoir\").buildChecked();\n      Class<?> codahaleHistogramClass =\n          DynClasses.builder().impl(\"com.codahale.metrics.Histogram\").buildChecked();\n      return new DropwizardCtors(\n          DynConstructors.builder()\n              .impl(\"com.codahale.metrics.SlidingWindowReservoir\", int.class)\n              .buildChecked(),\n          DynConstructors.builder()\n              .impl(\"com.codahale.metrics.Histogram\", reservoirInterface)\n              .buildChecked(),\n          DynConstructors.builder(Histogram.class)\n              .impl(\n                  \"org.apache.flink.dropwizard.metrics.DropwizardHistogramWrapper\",\n                  codahaleHistogramClass)\n              .buildChecked());\n    } catch (ClassNotFoundException | NoSuchMethodException e) {\n      LOG.warn(\n          \"Cannot load Dropwizard metrics; is org.apache.flink:flink-metrics-dropwizard on the classpath?\",\n          e);\n      return null;\n    }\n  }\n\n  private record DropwizardCtors(\n      DynConstructors.Ctor<?> reservoirCtor,\n      DynConstructors.Ctor<?> histogramCtor,\n      DynConstructors.Ctor<Histogram> wrapperCtor) {}\n}\n","sourceCodeStart":132,"sourceCodeEnd":162,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/flink/v1.20/flink/src/main/java/org/apache/iceberg/flink/sink/IcebergStreamWriterMetrics.java#L132-L162","documentation":"IcebergStreamWriterMetrics optionally exposes Dropwizard histograms for write latency. It loads org.apache.flink.dropwizard.metrics.DropwizardHistogramWrapper reflectively; when flink-metrics-dropwizard is not on the classpath the class can't be loaded, the metrics are disabled with this warning, and the writer continues without them.","triggerScenarios":"Running a Flink job with the Iceberg stream writer where the flink-metrics-dropwizard jar is absent from the job's classpath (lib/, uber-jar, or user code loader).","commonSituations":"Deploying the Iceberg Flink runtime jar standalone without the metrics reporter dependency; using a minimal Flink distribution; shading the job and excluding optional dependencies.","solutions":["Add org.apache.flink:flink-metrics-dropwizard (matching your Flink version) to the job jar or Flink lib/ directory.","Ignore the warning if the Dropwriter-based latency metrics are not needed — functionality is unaffected.","Verify the dependency isn't lost by shading exclusions (check the shaded uber-jar contents)."],"exampleFix":"// Maven: before (missing)\n<!-- no flink-metrics-dropwizard -->\n// after\n<dependency>\n  <groupId>org.apache.flink</groupId>\n  <artifactId>flink-metrics-dropwizard</artifactId>\n  <version>${flink.version}</version>\n</dependency>","handlingStrategy":"fallback","validationCode":"try {\n  Class.forName(\"org.apache.flink.dropwizard.metrics.DropwizardHistogramWrapper\");\n} catch (ClassNotFoundException e) {\n  LOG.warn(\"flink-metrics-dropwizard missing; latency histograms disabled\");\n}","typeGuard":null,"tryCatchPattern":"// Warning is non-fatal; if you need metrics, verify the jar at deploy time\ntry {\n  Class.forName(\"org.apache.flink.dropwizard.metrics.DropwizardHistogramWrapper\");\n} catch (ClassNotFoundException e) {\n  throw new IllegalStateException(\"Add flink-metrics-dropwizard to the classpath\", e);\n}","preventionTips":["Bundle flink-metrics-dropwizard in the job jar or Flink lib/.","Match its version to your Flink version.","Check shaded uber-jar for excluded optional dependencies."],"tags":["flink","metrics","classpath","dropwizard"],"backgroundTag":"missing-optional-dependency","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}