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

SystemModulesMap::classNames and moduleNames arrays do not match the order

    XMLWordPrintable

Details

    • 9
    • b05
    • generic
    • generic

    Backports

      Description

        A DESCRIPTION OF THE PROBLEM :
        I have a java-project that is build as module. The name of the module starts with "com" (e.g. com.project). This module has a dependency to jdk.httpserver. When I run the compiled jar with java command, then everything works fine. But when I build a runtime image with jlink and try to start that one, I get an error ("Module com.project not in boot Layer").
        If I change the module name to not start with "com" (e.g. org.project) or remove the dependency to jdk.httpserver or use Java 17, then the runtime image created by jlink works fine.

        REGRESSION : Last worked in version 17.0.9

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Create a java project with a starter class (com.project.Starter) containing the main method.
        Add module-info.java and name your project "com.project" and add dependency to "jdk.httpserver".
        Compile the project.
        Use jlink to build a runtime image:
        jlink --module-path "c:\<path-to-jdk>\jmods;out" --add-modules com.project --launcher starter=com.project/com.project.Starter --output image

        Execute image/bin/starter.bat and you will get an exception: "Module com.project not in boot Layer"

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Running application (no exception)
        ACTUAL -
        java.lang.InternalError: Module com.project not in boot Layer

        ---------- BEGIN SOURCE ----------
        ##Starter##
        package com.project;

        public class Starter {

            public static void main(String[] args) {
                System.out.println("Hello world");
            }
        }

        ##module-info.java##
        module com.project {
            requires jdk.httpserver;
        }
        ---------- END SOURCE ----------

        CUSTOMER SUBMITTED WORKAROUND :
        renaming module to not start with "com"

        FREQUENCY : always


        Attachments

          Issue Links

            Activity

              People

                mchung Mandy Chung
                webbuggrp Webbug Group
                Votes:
                0 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: