{"record":{"id":"567ad2826eef0ccf","repo":"quarkusio/quarkus","slug":"application-module-not-found","errorCode":null,"errorMessage":"Application module  not found","messagePattern":"Application module  not found","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions/packaging/jlink/launcher/src/main/java/io/quarkus/jlink/launcher/JLinkAppLauncher.java","lineNumber":67,"sourceCode":"        }\n\n        Path libPath = imagePath.resolve(\"lib\").resolve(\"quarkus\");\n\n        // create a layer for our dynamic modules\n        ModuleLoader dyn = new ModuleLoader(\"dyn\", ModuleFinder.fromFileSystem(List.of(libPath))) {\n            public LoadedModule loadModule(final String moduleName) {\n                LoadedModule found = base.loadModule(moduleName);\n                if (found == null) {\n                    found = super.loadModule(moduleName);\n                }\n                return found;\n            }\n        };\n\n        // load the application\n        LoadedModule loadedModule = dyn.loadModule(appModule);\n        if (loadedModule == null) {\n            throw new IllegalArgumentException(\"Application module \" + appModule + \" not found\");\n        }\n\n        // set up TCCL; todo: stop relying on this\n        Thread.currentThread().setContextClassLoader(loadedModule.classLoader());\n\n        // find the main class\n        String mainClassName = loadedModule.module()\n                .getDescriptor()\n                .mainClass()\n                .orElseThrow(() -> new IllegalArgumentException(\n                        \"Application module \" + appModule + \" does not have a defined main class\"));\n        Class<?> mainClass;\n        try {\n            mainClass = Class.forName(mainClassName, true, loadedModule.classLoader());\n        } catch (ClassNotFoundException e) {\n            throw sneak(e);\n        }\n","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/packaging/jlink/launcher/src/main/java/io/quarkus/jlink/launcher/JLinkAppLauncher.java#L49-L85","documentation":"The launcher creates a ModuleLoader over the image's lib/quarkus directory and calls loadModule(appModule) to load the application module passed as the first argument. A null result means no module descriptor with that name was found in lib/quarkus, so the requested application module does not exist in the image. The appModule name is interpolated into the message.","triggerScenarios":"Running image/bin/<launcher> with an app module name that was not bundled into the image's lib/quarkus directory — wrong module name on the command line, or the image was built without that module.","commonSituations":"Typos in the module name argument after rebuilding/renaming the application module; stale image from an older build where the module had a different name; manual pruning of lib/quarkus jars.","solutions":["Check the module name argument matches the module-info name of the application (ls image/lib/quarkus/ to see bundled module jars)","Rebuild the jlink image so the current application module is bundled","Regenerate the launcher script (it embeds the correct app module name) instead of hand-editing it"],"exampleFix":"// before: wrong/stale module name\nimage/bin/myapp com.example.oldmodule\n// after: name matching image/lib/quarkus/com.example.app.jar\nimage/bin/myapp com.example.app","handlingStrategy":"validation","validationCode":"// verify the app module is bundled before launching\nPath libQuarkus = imagePath.resolve(\"lib\").resolve(\"quarkus\");\nboolean found;\ntry (Stream<Path> jars = Files.list(libQuarkus)) {\n    found = jars.anyMatch(j -> j.getFileName().toString().equals(appModule + \".jar\"));\n}\nif (!found) throw new IllegalArgumentException(\"Module not in lib/quarkus: \" + appModule);","typeGuard":"boolean isModuleBundled(String moduleName, Path libQuarkus) throws IOException {\n    try (Stream<Path> jars = Files.list(libQuarkus)) {\n        return jars.anyMatch(j -> j.getFileName().toString().equals(moduleName + \".jar\"));\n    }\n}","tryCatchPattern":"try {\n    JLinkAppLauncher.run(appModule, args);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"not found\")) {\n        System.err.println(\"Wrong app module name; check image/lib/quarkus contents\");\n    }\n    throw e;\n}","preventionTips":["Use the generated launcher script, which embeds the correct module name","Rebuild the image after renaming the application module","List image/lib/quarkus/ to confirm bundled module names before launching"],"tags":["jlink","jpms","module-not-found"],"backgroundTag":"module-not-found","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}