Java "module.FindException" in CI - Fix the Module Path
FindException is thrown while the boot layer resolves modules: a required module is not on the module path, two modules share a name, or an automatic module name is ambiguous. The JVM aborts before main runs.
What this error means
Startup fails with Error occurred during initialization of boot layer followed by java.lang.module.FindException: Module com.example.core not found, required by app (or two versions of module ...).
Error occurred during initialization of boot layer
java.lang.module.FindException: Module com.example.core not found, required by appCommon causes
Required module not on the module path
A requires in module-info names a module whose jar is on the classpath but not the module path, so resolution fails.
Duplicate or clashing module names
Two jars derive the same automatic module name, or two versions of one module are on the path, and the resolver cannot choose.
How to fix it
Put the module on the module path
Launch with --module-path including every required modular jar.
- run: >
java
--module-path libs:app.jar
--module app/com.example.app.MainResolve name clashes
- Run with
--show-module-resolutionto see what the resolver picks and where it fails. - Give libraries explicit
Automatic-Module-Namemanifest entries to avoid derived-name clashes. - Ensure only one version of each module is on the path.
How to prevent it
- Keep modular jars on the module path (not the classpath), set stable Automatic-Module-Name values, and verify resolution with
--show-module-resolutionin CI.