4

I got really nasty problem that I do not understand...

  1. We have a whole set of util-libraries written with jdk8 and no relation to jigsaw so we also do not have set the Automatic-Module-Name within the META-INF file.

  2. Now we need to migrate a product to java11 that uses these util-libraries.

  3. I created a module-info.java and entered all required modules but there are some problems with the util-libraries.
  4. Some of the util libraries are loaded as unnamed-modules and it is possible to add them as required modules. But for some other of these util-libraries it is not possible to add them because they do not get a module-name based on their jar-file.

From my IDE I get the folloging error:

package 'x' is declared in the unnamed module but module 'y' does not read it.

package x is within one of our util-libraries and module y is the product that should be migrated to java11.

Any ideas so that I can understand this problem?

Best regards

2
  • How does your jar-filenames look like? If there are numbers in it at different positions that could be a problem. Commented Aug 12, 2019 at 8:39
  • the jarfiles are from my local maven repository and the naming is simply up to normal conventions: "autent-saml-redirect-binding-client-0.2.1.jar" Commented Aug 12, 2019 at 9:05

2 Answers 2

4

I use AdoptOpenJDK jdk-11.0.3.7-hotspot and had the following exception message at runtime

class A (in module A) cannot access class B (in unnamed module @0x12345678) because module A does not read unnamed module @0x12345678 

and solved it by using the --add-reads vm argument

--add-reads iamdsim.heat.adapter=ALL-UNNAMED 

I read somewhere that only automatic modules "read" the unnamed module by default. But i could not find it in the java.lang.module packagedoc.

Edit: It is documented in The State of the Module System

jar-files with names for which no automatic module name can be derived are always a pain. It happens with numbers or reserved words like "interface" in the name (e.g. "db-interface-1.0.0.jar").

Sign up to request clarification or add additional context in comments.

Comments

4

The solution of this specific problem was just my IDE. IntelliJ does not support reading "unnamed modules" or "automatic modules" from imported "projects" within the IDE. I already started a bugreport at jetbrains.

1 Comment

Hi, do you have the case number for this issue so that we can trace it as well?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.