jlink RuntimeException: descriptor returns inconsistent package set

Jim Connors james.connors at oracle.com
Thu Feb 9 18:42:54 UTC 2017


Trying to create JDK9 runtime image that includes only the necessary 
modules to run a JavaFX program called Scoreboard.  It has been 
converted to a JDK9 module called Scoreboard and has dependencies on 
system modules as well as another module called com.jtconnors.socket.   
More details below, this program runs fine when invoked with jdk9-ea+155 
as follows (Scoreboard.jar and com.jtconnors.socket.jar are in the 
current directory):

    C:\tmp\scratch>java --module-path . -m Scoreboard

However when attempting to create the jlink image as follows, this error 
message appears:

    C:\tmp\scratch>jlink --module-path .;\Users\jtconnor\jdk-9\jmods
    --add-modules S
    coreboard --output reducedImage --compress=2 --strip-debug
    Error: java.lang.RuntimeException: Module Scoreboard's descriptor
    returns incons
    istent package set

Here are step-by-step details, First thing shown here is what worked:

Example 1: create was a reduced Jdk9 runtime image that includes just 
the com.jtconnors.socket module with all it's dependencies.  Here's what 
the module-info.java file for com.jtconnors.socket looks like:

    module com.jtconnors.socket {
         requires java.base;
         requires java.logging;
         exports com.jtconnors.socket;
         exports com.jtconnors.socket.test;
    }

Here's my PATH:

    C:\tmp\scratch>echo %PATH%
    C:\users\jtconnor\jdk-9\bin;C:\ProgramData\Oracle\Java\javapath;D:\Oracle\jdk8\b
    in;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\W
    indowsPowerShell\v1.0\;C:\Program
    Files\nodejs\;D:\Oracle\mysql-5.7.16-winx64\bi
    n\;C:\Users\jtconnor\jdk-9\bin;C:\Users\jtconnor\AppData\Roaming\npm

And here's what java -version says:

    C:\tmp\scratch>java -version
    java version "9-ea"
    Java(TM) SE Runtime Environment (build 9-ea+155)
    Java HotSpot(TM) 64-Bit Server VM (build 9-ea+155, mixed mode)

The com.jtconnors.socket.jar file is in the C:\tmp\scratch directory:

    C:\tmp\scratch>dir
      Volume in drive C has no label.
      Volume Serial Number is 5C29-8814

      Directory of C:\tmp\scratch

    02/08/2017  07:39 PM    <DIR>          .
    02/08/2017  07:39 PM    <DIR>          ..
    02/08/2017  07:03 PM            60,051 com.jtconnors.socket.jar
                    1 File(s)         60,051 bytes
                    2 Dir(s)  299,772,723,200 bytes free

jdeps output for com.jtconnors.socket:

    C:\tmp\scratch>jdeps -s com.jtconnors.socket.jar
    com.jtconnors.socket -> java.base
    com.jtconnors.socket -> java.logging

Created a runtime image as follows:

    C:\tmp\scratch>jlink --module-path .;\users\jtconnor\jdk-9\jmods
    --add-modules com.jtconnors.socket --output reducedImage
    --compress=2 --strip-debub

Run java -version with thereducedImage runtime

    C:\tmp\scratch>reducedImage\bin\java -version
    java version "9-ea"
    Java(TM) SE Runtime Environment (build 9-ea+155)
    Java HotSpot(TM) 64-Bit Server VM (build 9-ea+155, mixed mode)

List the modules in the reducedImage runtime:

    C:\tmp\scratch>reducedImage\bin\java --list-modules
    com.jtconnors.socket
    java.base at 9-ea
    java.logging at 9-ea

Run test program that comes with the com.jtconnors.socket module:
C:\tmp\scratch>reducedImage\bin\java -m 
com.jtconnors.socket/com.jtconnors.socke
t.test.SocketServerReceiver

    Feb 08, 2017 7:48:32 PM
    com.jtconnors.socket.test.SocketServerReceiver initSocke
    tConnection
    INFO: Waiting for connection

Example 2: Trying to create a jlink image for the Scoreboard 
application, this is where jlink produces a RuntimeException

Here's what Scoreboard's module-info.java file looks like:

    module Scoreboard {
         requires java.base;
         requires com.jtconnors.socket;
         requires java.logging;
         requires java.xml;
         requires javafx.base;
         requires javafx.controls;
         requires javafx.graphics;
         requires javafx.media;
         exports scoreboard.fx2;
    }

jdeps output for Scoreboard.jar:

    C:\tmp\scratch>jdeps --module-path . -s Scoreboard.jar
    Scoreboard -> com.jtconnors.socket
    Scoreboard -> java.base
    Scoreboard -> java.logging
    Scoreboard -> java.xml
    Scoreboard -> javafx.base
    Scoreboard -> javafx.controls
    Scoreboard -> javafx.graphics
    Scoreboard -> javafx.media

Attempted to create a runtime image as follows and got this output:

    C:\tmp\scratch>jlink --module-path .;\Users\jtconnor\jdk-9\jmods
    --add-modules S
    coreboard --output reducedImage --compress=2 --strip-debug
    Error: java.lang.RuntimeException: Module Scoreboard's descriptor
    returns incons
    istent package set



More information about the jigsaw-dev mailing list