2

Ubuntu packages seem to install java libraries in /usr/share/java directory but when trying to add this path to the command line. Java tries to validate every file in there and seems to fail. Ex:

$ java --module-path /usr/share/java --list-modules
Error occurred during initialization of boot layer
java.lang.module.FindException: Unable to derive module descriptor for /usr/share/java/groovy.jar
Caused by: java.lang.module.InvalidModuleDescriptorException: Provider class groovy not in module

(note that it also fails on other files, jansi-native.jar being one)

The only other issue I could find discussing something similar to this problem is Tomcat6 libs and /usr/share/java on Ubuntu but hopefully there is a better solution now than "wipe everything and start from scratch"?

Just in case:

$ java --version
openjdk 11.0.3 2019-04-16
OpenJDK Runtime Environment (build 11.0.3+7-Ubuntu-1ubuntu1)
OpenJDK 64-Bit Server VM (build 11.0.3+7-Ubuntu-1ubuntu1, mixed mode)

Is there a way to ignore failed validations or am I missing how I should use those modules properly?

edit: Just to clarify, the issue isn't specifically about groovy, it's about the java module path validation. If it doesn't fail on groovy it will fail on something else:

$ java --module-path /usr/share/java --list-modules
Error occurred during initialization of boot layer
java.lang.module.FindException: Two versions of module xom found in /usr/share/java (xom.jar and xom-1.2.10.jar)

/usr/share/java$ ls *xom* -la
-rw-r--r-- 1 root root 182373 Jul 26  2013 xom-1.2.10.jar
lrwxrwxrwx 1 root root     14 Jul 26  2013 xom.jar -> xom-1.2.10.jar

I tried to remove all the packages that were causing issues(either through error in the jar or symlinked modules) until this one:

$ java --module-path /usr/share/java --list-modules
Error occurred during initialization of boot layer
java.lang.module.FindException: Unable to derive module descriptor for /usr/share/java/jansi-native-1.8.jar
Caused by: java.lang.IllegalArgumentException: jansi.native: Invalid module name: 'native' is not a Java identifier

Sadly I can't remove this package as it is a dependency for maven.

RipleyTom
  • 21
  • 3
  • The [answer here](https://stackoverflow.com/questions/50163197/groovy-java-9-modules-support) discusses the solution to *Provider class groovy not in module*. I have added an explanation for the cause in a similar [answer here](https://stackoverflow.com/a/54682966/1746118). – Naman May 11 '19 at 02:04
  • 1
    aside: make sure you're on the latest groovy version and mention the details around it in the question. – Naman May 11 '19 at 02:09
  • I don't know how many JAR files are in your /usr/share/java directory but the majority are likely been treated as automatic modules as they have not been migrated to explicit modules (they don't have a module-info.class). I'm sure it will improve in time but it needs the maintainers of all these libraries to migrate. – Alan Bateman May 11 '19 at 15:12

0 Answers0