Repository navigation
Description
I had started with setting up using maven. Things work fine with Java-8 and additionally even on moving to Java-15 as a non-modular application. Further, I have added a module-info.java to modularise this application I am working upon with the following code:
module a.bit.of.dz {
requires dropwizard.core;
}
Using IntelliJ, when I am trying to run the application, it fails with
java.lang.module.ResolutionException: Modules dropwizard.validation and dropwizard.core export package io.dropwizard.validation to module com.codahale.metrics.health
for anyone interested in the complete command line transformed for this execution
/Library/Java/JavaVirtualMachines/jdk-15.jdk/Contents/Home/bin/java -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:49814,suspend=y,server=n --enable-preview -javaagent:.../Library/Caches/JetBrains/IdeaIC2020.3/captureAgent/debugger-agent.jar -Dfile.encoding=UTF-8 -classpath /Applications/IntelliJ IDEA CE.app/Contents/lib/idea_rt.jar -p .../Desktop/namannigam/a-bit-of-dz/target/classes:.../.m2/repository/io/dropwizard/dropwizard-core/2.0.18/dropwizard-core-2.0.18.jar:.../.m2/repository/io/dropwizard/dropwizard-util/2.0.18/dropwizard-util-2.0.18.jar:.../.m2/repository/com/google/guava/guava/30.1-jre/guava-30.1-jre.jar:.../.m2/repository/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar:.../.m2/repository/com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar:.../.m2/repository/org/checkerframework/checker-qual/3.9.0/checker-qual-3.9.0.jar:.../.m2/repository/com/google/errorprone/error_prone_annotations/2.4.0/error_prone_annotations-2.4.0.jar:.../.m2/repository/com/google/j2objc/j2objc-annotations/1.3/j2objc-annotations-1.3.jar:.../.m2/repository/io/dropwizard/dropwizard-jackson/2.0.18/dropwizard-jackson-2.0.18.jar:.../.m2/repository/com/github/ben-manes/caffeine/caffeine/2.8.8/caffeine-2.8.8.jar:.../.m2/repository/com/fasterxml/jackson/core/jackson-core/2.10.5/jackson-core-2.10.5.jar:.../.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-guava/2.10.5/jackson-datatype-guava-2.10.5.jar:.../.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.10.5/jackson-datatype-jsr310-2.10.5.jar:.../.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.10.5/jackson-datatype-jdk8-2.10.5.jar:.../.m2/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.10.5/jackson-module-parameter-names-2.10.5.jar:.../.m2/repository/com/fasterxml/jackson/module/jackson-module-afterburner/2.10.5/jackson-module-afterburner-2.10.5.jar:.../.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-joda/2.10.5/jackson-datatype-joda-2.10.5.jar:.../.m2/repository/io/dropwizard/dropwizard-validation/2.0.18/dropwizard-validation-2.0.18.jar:.../.m2/repository/org/glassfish/jakarta.el/3.0.3/jakarta.el-3.0.3.jar:.../.m2/repository/io/dropwizard/dropwizard-configuration/2.0.18/dropwizard-configuration-2.0.18.jar:.../.m2/repository/com/fasterxml/jackson/dataformat/jackson-dataformat-yaml/2.10.5/jackson-dataformat-yaml-2.10.5.jar:.../.m2/repository/org/yaml/snakeyaml/1.26/snakeyaml-1.26.jar:.../.m2/repository/org/apache/commons/commons-text/1.9/commons-text-1.9.jar:.../.m2/repository/io/dropwizard/dropwizard-logging/2.0.18/dropwizard-logging-2.0.18.jar:.../.m2/repository/io/dropwizard/metrics/metrics-logback/4.1.17/metrics-logback-4.1.17.jar:.../.m2/repository/org/slf4j/jul-to-slf4j/1.7.30/jul-to-slf4j-1.7.30.jar:.../.m2/repository/ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3.jar:.../.m2/repository/io/dropwizard/logback/logback-throttling-appender/1.1.0/logback-throttling-appender-1.1.0.jar:.../.m2/repository/org/slf4j/log4j-over-slf4j/1.7.30/log4j-over-slf4j-1.7.30.jar:.../.m2/repository/org/slf4j/jcl-over-slf4j/1.7.30/jcl-over-slf4j-1.7.30.jar:.../.m2/repository/io/dropwizard/dropwizard-metrics/2.0.18/dropwizard-metrics-2.0.18.jar:.../.m2/repository/io/dropwizard/dropwizard-jersey/2.0.18/dropwizard-jersey-2.0.18.jar:.../.m2/repository/org/glassfish/jersey/core/jersey-server/2.32/jersey-server-2.32.jar:.../.m2/repository/org/glassfish/jersey/media/jersey-media-jaxb/2.32/jersey-media-jaxb-2.32.jar:.../.m2/repository/jakarta/xml/bind/jakarta.xml.bind-api/2.3.3/jakarta.xml.bind-api-2.3.3.jar:.../.m2/repository/jakarta/activation/jakarta.activation-api/1.2.2/jakarta.activation-api-1.2.2.jar:.../.m2/repository/org/glassfish/jersey/ext/jersey-metainf-services/2.32/jersey-metainf-services-2.32.jar:.../.m2/repository/org/glassfish/jersey/inject/jersey-hk2/2.32/jersey-hk2-2.32.jar:.../.m2/repository/org/glassfish/hk2/hk2-locator/2.6.1/hk2-locator-2.6.1.jar:.../.m2/repository/org/javassist/javassist/3.27.0-GA/javassist-3.27.0-GA.jar:.../.m2/repository/io/dropwizard/metrics/metrics-jersey2/4.1.17/metrics-jersey2-4.1.17.jar:.../.m2/repository/com/fasterxml/jackson/jaxrs/jackson-jaxrs-json-provider/2.10.5/jackson-jaxrs-json-provider-2.10.5.jar:.../.m2/repository/com/fasterxml/jackson/jaxrs/jackson-jaxrs-base/2.10.5/jackson-jaxrs-base-2.10.5.jar:.../.m2/repository/com/fasterxml/jackson/module/jackson-module-jaxb-annotations/2.10.5/jackson-module-jaxb-annotations-2.10.5.jar:.../.m2/repository/jakarta/annotation/jakarta.annotation-api/1.3.5/jakarta.annotation-api-1.3.5.jar:.../.m2/repository/joda-time/joda-time/2.10.9/joda-time-2.10.9.jar:.../.m2/repository/org/glassfish/hk2/hk2-api/2.6.1/hk2-api-2.6.1.jar:.../.m2/repository/org/glassfish/hk2/hk2-utils/2.6.1/hk2-utils-2.6.1.jar:.../.m2/repository/org/glassfish/hk2/external/aopalliance-repackaged/2.6.1/aopalliance-repackaged-2.6.1.jar:.../.m2/repository/org/glassfish/jersey/containers/jersey-container-servlet/2.32/jersey-container-servlet-2.32.jar:.../.m2/repository/org/glassfish/jersey/containers/jersey-container-servlet-core/2.32/jersey-container-servlet-core-2.32.jar:.../.m2/repository/org/glassfish/jersey/core/jersey-client/2.32/jersey-client-2.32.jar:.../.m2/repository/org/eclipse/jetty/jetty-io/9.4.35.v20201120/jetty-io-9.4.35.v20201120.jar:.../.m2/repository/org/apache/commons/commons-lang3/3.11/commons-lang3-3.11.jar:.../.m2/repository/io/dropwizard/dropwizard-servlets/2.0.18/dropwizard-servlets-2.0.18.jar:.../.m2/repository/io/dropwizard/metrics/metrics-annotation/4.1.17/metrics-annotation-4.1.17.jar:.../.m2/repository/io/dropwizard/dropwizard-jetty/2.0.18/dropwizard-jetty-2.0.18.jar:.../.m2/repository/org/eclipse/jetty/jetty-servlets/9.4.35.v20201120/jetty-servlets-9.4.35.v20201120.jar:.../.m2/repository/org/eclipse/jetty/jetty-continuation/9.4.35.v20201120/jetty-continuation-9.4.35.v20201120.jar:.../.m2/repository/org/eclipse/jetty/jetty-http/9.4.35.v20201120/jetty-http-9.4.35.v20201120.jar:.../.m2/repository/io/dropwizard/dropwizard-lifecycle/2.0.18/dropwizard-lifecycle-2.0.18.jar:.../.m2/repository/io/dropwizard/metrics/metrics-core/4.1.17/metrics-core-4.1.17.jar:.../.m2/repository/io/dropwizard/metrics/metrics-jetty9/4.1.17/metrics-jetty9-4.1.17.jar:.../.m2/repository/io/dropwizard/metrics/metrics-jvm/4.1.17/metrics-jvm-4.1.17.jar:.../.m2/repository/io/dropwizard/metrics/metrics-jmx/4.1.17/metrics-jmx-4.1.17.jar:.../.m2/repository/io/dropwizard/metrics/metrics-servlets/4.1.17/metrics-servlets-4.1.17.jar:.../.m2/repository/io/dropwizard/metrics/metrics-json/4.1.17/metrics-json-4.1.17.jar:.../.m2/repository/com/helger/profiler/1.1.1/profiler-1.1.1.jar:.../.m2/repository/io/dropwizard/metrics/metrics-healthchecks/4.1.17/metrics-healthchecks-4.1.17.jar:.../.m2/repository/io/dropwizard/dropwizard-request-logging/2.0.18/dropwizard-request-logging-2.0.18.jar:.../.m2/repository/ch/qos/logback/logback-access/1.2.3/logback-access-1.2.3.jar:.../.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar:.../.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.10.5.1/jackson-databind-2.10.5.1.jar:.../.m2/repository/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar:.../.m2/repository/jakarta/servlet/jakarta.servlet-api/4.0.4/jakarta.servlet-api-4.0.4.jar:.../.m2/repository/jakarta/ws/rs/jakarta.ws.rs-api/2.1.6/jakarta.ws.rs-api-2.1.6.jar:.../.m2/repository/net/sourceforge/argparse4j/argparse4j/0.8.1/argparse4j-0.8.1.jar:.../.m2/repository/org/eclipse/jetty/jetty-security/9.4.35.v20201120/jetty-security-9.4.35.v20201120.jar:.../.m2/repository/org/eclipse/jetty/jetty-server/9.4.35.v20201120/jetty-server-9.4.35.v20201120.jar:.../.m2/repository/org/eclipse/jetty/jetty-servlet/9.4.35.v20201120/jetty-servlet-9.4.35.v20201120.jar:.../.m2/repository/org/eclipse/jetty/jetty-util-ajax/9.4.35.v20201120/jetty-util-ajax-9.4.35.v20201120.jar:.../.m2/repository/org/eclipse/jetty/jetty-util/9.4.35.v20201120/jetty-util-9.4.35.v20201120.jar:.../.m2/repository/org/eclipse/jetty/toolchain/setuid/jetty-setuid-java/1.0.4/jetty-setuid-java-1.0.4.jar:.../.m2/repository/org/glassfish/hk2/external/jakarta.inject/2.6.1/jakarta.inject-2.6.1.jar:.../.m2/repository/org/glassfish/jersey/core/jersey-common/2.32/jersey-common-2.32.jar:.../.m2/repository/org/glassfish/hk2/osgi-resource-locator/1.0.3/osgi-resource-locator-1.0.3.jar:.../.m2/repository/com/sun/activation/jakarta.activation/1.2.2/jakarta.activation-1.2.2.jar:.../.m2/repository/org/glassfish/jersey/ext/jersey-bean-validation/2.32/jersey-bean-validation-2.32.jar:.../.m2/repository/org/slf4j/slf4j-api/1.7.30/slf4j-api-1.7.30.jar:.../.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.10.5/jackson-annotations-2.10.5.jar:.../.m2/repository/jakarta/validation/jakarta.validation-api/2.0.2/jakarta.validation-api-2.0.2.jar:.../.m2/repository/org/hibernate/validator/hibernate-validator/6.1.7.Final/hibernate-validator-6.1.7.Final.jar:.../.m2/repository/org/jboss/logging/jboss-logging/3.3.2.Final/jboss-logging-3.3.2.Final.jar:.../.m2/repository/com/fasterxml/classmate/1.5.1/classmate-1.5.1.jar -m a.bit.of.dz/edu.bit.DzApplication server .../a-bit-of-dz/config.yml
Here is a reproducible example https://github.com/namannigam/a-bit-of-dz
Activity
[-]java.lang.module.ResolutionException while executiing with Java-15[/-][+]java.lang.module.ResolutionException while executing basic application with Java-15[/+]namannigam commentedon Jan 14, 2021
I could further notice, the module
com.codahale.metrics.healthis the explicit module name defiinied for<groupId>io.dropwizard.metrics</groupId <artifactId>metrics-healthchecks</artifactId>. So, eventually these look like internal dependency conflicts only, is that understanding correct?joschi commentedon Jan 14, 2021
Dropwizard is currently not fully compatible with JPMS.
#3233
#2926
namannigam commentedon Jan 15, 2021
@joschi any leads on what is planned as a resolution, so as to expedite this?
joschi commentedon Jan 15, 2021
@namannigam For backward-compatibility reasons, this will earliest be tackled in Dropwizard 3.0.x (no scheduled release date yet).
Until then, please use Dropwizard on the class path and not on the module path.
namannigam commentedon Jan 17, 2021
@joschi Just to leave it as a note on the risk of sounding too optimistic, I was looking to build a custom runtime image of an application based on Dropwizard using
jlinkand further making usejpackageto figure out some migration plans. But all of that wouldn't really be possible even with the core libraries inferred as an automatic module which was this one-off failure attempt from me.Thihup commentedon Feb 5, 2021
@namannigam You still can create JLinked runtime with automatic modules, however, there is a little more of manual configuration, but the results should be the same:
https://medium.com/azulsystems/using-jlink-to-build-java-runtimes-for-non-modular-applications-9568c5e70ef4
namannigam commentedon Feb 5, 2021
@Thihup thank you for pitching in, the configuration discussed in the post seems to be very specific to JDK modules or other modules coupled with them. I have skimmed through it, but don't really find it promising for the use case we are dealing with here.
Thihup commentedon Feb 6, 2021
Sure. As for my use cases, I could use the JLink with automatic modules. I just don't recall if you can create a launcher if you don't have all modules, but from what I've used, JLink basically just uses the module-info to get all the modules needed. If you have an automatic module it cannot auto-detect, but you can use the JDeps to list it. So you can add all modules that the JDeps have said and you would have almost the same thing as all of the jars were modularized. Probably your use case can be a little different, sure, but maybe it would be the same thing.
Clean up overlapping package structure
github-actions commentedon Feb 3, 2022
This issue is stale because it has been open 90 days with no activity. Remove the "stale" label or comment or this will be closed in 14 days.
Clean up package structure (#3233)