Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8345573

Module dependencies not resolved from run-time image when --limit-module is being used

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 25
    • 24, 25
    • tools
    • b03
    • generic
    • generic

        For a JEP 493 enabled JDK linking in an JDK external module and limiting on that module results in a find exception on JDK dependency-modules:

        $ jar -d -f hello.jar
        com.other jar:file:////path/to/hello.jar!/module-info.class
        exports com.other
        requires java.base mandated
        requires java.desktop
        $ bin/jlink --add-modules com.other --module-path $(pwd):$(pwd)/jmods --limit-modules com.other --verbose --output testme-imagebin/jlink --add-modules com.other --module-path $(pwd) --limit-modules com.other --verbose
        Error: Module java.desktop not found, required by com.other
        java.lang.module.FindException: Module java.desktop not found, required by com.other
        at java.base/java.lang.module.Resolver.findFail(Resolver.java:892)
        at java.base/java.lang.module.Resolver.resolve(Resolver.java:192)
        at java.base/java.lang.module.Resolver.resolve(Resolver.java:141)
        at java.base/java.lang.module.Configuration.resolve(Configuration.java:413)
        at java.base/java.lang.module.Configuration.resolve(Configuration.java:252)
        at jdk.jlink/jdk.tools.jlink.internal.JlinkTask.limitFinder(JlinkTask.java:786)
        at jdk.jlink/jdk.tools.jlink.internal.JlinkTask.newModuleFinder(JlinkTask.java:552)
        at jdk.jlink/jdk.tools.jlink.internal.JlinkTask.initJlinkConfig(JlinkTask.java:396)
        at jdk.jlink/jdk.tools.jlink.internal.JlinkTask.run(JlinkTask.java:289)
        at jdk.jlink/jdk.tools.jlink.internal.Main.run(Main.java:50)
        at jdk.jlink/jdk.tools.jlink.internal.Main.main(Main.java:34)

        For a regular JDK build this works since the `jmods` directory can get added to the module path. For JEP 493 enabled JDKs this directory is not there. However, the dependencies should still be possible to be resolved from the run-time image.

        Without --limit-modules this works fine:

        $ bin/jlink --add-modules com.other --module-path $(pwd):$(pwd)/jmods --verbose --output testme-imagebin/jlink --add-modules com.other --module-path $(pwd) --limit-modules com.other --verbose
        Linking based on the current run-time image
        com.other file:///path/to/hello.jar
        java.base jrt:/java.base (run-time image)
        java.datatransfer jrt:/java.datatransfer (run-time image)
        java.desktop jrt:/java.desktop (run-time image)
        java.prefs jrt:/java.prefs (run-time image)
        java.xml jrt:/java.xml (run-time image)

        Providers:
          java.desktop provides java.net.ContentHandlerFactory used by java.base
          java.base provides java.nio.file.spi.FileSystemProvider used by java.base
          java.desktop provides javax.print.PrintServiceLookup used by java.desktop
          java.desktop provides javax.print.StreamPrintServiceFactory used by java.desktop
          java.desktop provides javax.sound.midi.spi.MidiDeviceProvider used by java.desktop
          java.desktop provides javax.sound.midi.spi.MidiFileReader used by java.desktop
          java.desktop provides javax.sound.midi.spi.MidiFileWriter used by java.desktop
          java.desktop provides javax.sound.midi.spi.SoundbankReader used by java.desktop
          java.desktop provides javax.sound.sampled.spi.AudioFileReader used by java.desktop
          java.desktop provides javax.sound.sampled.spi.AudioFileWriter used by java.desktop
          java.desktop provides javax.sound.sampled.spi.FormatConversionProvider used by java.desktop
          java.desktop provides javax.sound.sampled.spi.MixerProvider used by java.desktop
          java.desktop provides sun.datatransfer.DesktopDatatransferService used by java.datatransfer

              sgehwolf Severin Gehwolf
              sgehwolf Severin Gehwolf
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: