Remove dependency on DropwizardMetricsFactory in native-image's classpath dependencies when using Cassandra
See original GitHub issueThis problem appears only when I run a Quarkus’ native runner.
Example, with a simple quarkus-app.jar I don’t get the problem, but when I build a native image runner, this problem appears during each Cassandra requesting.
In my project I use following Quarkus’ version:
<quarkus-plugin.version>1.12.1.Final</quarkus-plugin.version>
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
<quarkus.platform.version>1.12.1.Final</quarkus.platform.version>
And I built the application with “mvn clean package -Pnative -Dnative-image.xmx=9g” command line.It’s very strange because, even if I set:
“quarkus.cassandra.metrics.enable=false” without dependency to “java-driver-metrics-micrometer” (or micropofile or metrics-jmx" dependency)
Or “quarkus.cassandra.metrics.enable=true” with dependency to “java-driver-metrics-micrometer” (or micropofile or metrics-jmx" dependency)
The bevaviour when the native image running, is the same … ClassNotFoundException.I don’t know with this problem appears only in native mode, but I search a mean to “disabled” the metrics’ system (for more lightness, or even at worst have them at runtime, but without the error)
I tried with the most recent com.datastax.oss java-driver-code’s version “4.10.0”
But I was hoping to have the behavior advertised in the documentation, but unless I’m wrong about being able to disable … I just wish I didn’t have the problem
But for me it seems the DropwizardMetricsFactory class isn’t registered for reflexion at the runtime. I know is possible to register it, but if I make this, should register all the linked classes located in ?
<dependency>
<groupId>com.datastax.oss</groupId>
<artifactId>java-driver-core</artifactId>
<version>4.10.0</version>
</dependency>
I don’t know the best to by default registe the Datastax classes which cause the problem, or fixe the problem by not searching to instanciate the factory is the application.propreties of metrics.enable is to “false” value.
I precise, I tried to use all following dependencies, but same thing, not found at the native’s runtime: <dependency> <groupId>com.datastax.oss</groupId> <artifactId>java-driver-metrics-micrometer</artifactId> <version>4.10.0</version> </dependency> <dependency> <groupId>io.dropwizard.metrics</groupId> <artifactId>metrics-jmx</artifactId> <version>4.1.18</version> </dependency> <dependency> <groupId>com.datastax.oss</groupId> <artifactId>java-driver-metrics-microprofile</artifactId> <version>4.10.0</version> </dependency>
Issue Analytics
- State:
- Created 3 years ago
- Comments:12 (6 by maintainers)
Closing then, thanks!
Hi, for future reference, indeed this issue was fixed in the Cassandra driver 4.11.0, see here. Then the fix was incorporated in the Cassandra extension 1.0.1, see here.