Skip to content
Latchkey

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 ...).

java
Error occurred during initialization of boot layer
java.lang.module.FindException: Module com.example.core not found, required by app

Common 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.

.github/workflows/ci.yml
- run: >
    java
    --module-path libs:app.jar
    --module app/com.example.app.Main

Resolve name clashes

  1. Run with --show-module-resolution to see what the resolver picks and where it fails.
  2. Give libraries explicit Automatic-Module-Name manifest entries to avoid derived-name clashes.
  3. 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-resolution in CI.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →