container
container copied to clipboard
Explicitly required module ALL-MODULE-PATH is not available
When trying to build a native image with graalvm-ce-java17-22.2.0 and the following options:
${GRAALVM_HOME}\bin\native-image \
--no-fallback \
--module-path ${LIB_FOLDER} \
--add-modules ALL-MODULE-PATH \
--module ${MAIN_MODULE} \
-H:ConfigurationFileDirectories=META-INF\native-image \
-H:+ReportUnsupportedElementsAtRuntime \
-H:+ReportExceptionStackTraces
I get the following error:
Fatal error: com.oracle.svm.core.util.VMError$HostedError: Explicitly required module ALL-MODULE-PATH is not available
at org.graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.shouldNotReachHere(VMError.java:68)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.ModuleLayerFeature.lambda$afterAnalysis$2(ModuleLayerFeature.java:160)
at java.base/java.lang.Iterable.forEach(Iterable.java:75)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.ModuleLayerFeature.afterAnalysis(ModuleLayerFeature.java:157)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$12(NativeImageGenerator.java:752)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:78)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:752)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:564)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:521)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:407)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:585)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:128)
Is the add-modules option not supported in native-image? Or is the option ALL_MODULE_PATH not supported? The native-image help shows that the option as well as the value should be working.
Hi, Thank you for reporting this, we'll take a look into it and get back to you
Is it possible to provide a reproducer for this issue?
Yes I will provide a reproducer that I can share. Just need some time to cleanup and push to my GitHub account.
Instead of preparing the GitHub repo (need some time to get everything ready) I have attached the sample in the archive file.
Without the option --add-modules ALL-MODULE-PATH
it seems the resulting image is missing some resources. You can see this when you start the executable as there will be an exception and some warnings about missing resources.
I also noticed that the classpath option is not working as expected.
-
--class-path atomos_lib/*
=>
Error: Unknown arguments: atomos_lib/configurable-1.0.0-SNAPSHOT.jar, atomos_lib/eventhandler-1.0.0-SNAPSHOT.jar, atomos_lib/impl-1.0.0-SNAPSHOT.jar, atomos_lib/org.apache.felix.atomos-1.0.0.jar, atomos_lib/org.apache.felix.configadmin-1.9.24.jar, atomos_lib/org.apache.felix.gogo.command-1.1.2.jar, atomos_lib/org.apache.felix.gogo.runtime-1.1.6.jar, atomos_lib/org.apache.felix.gogo.shell-1.1.4.jar, atomos_lib/org.apache.felix.scr-2.2.0.jar, atomos_lib/org.eclipse.equinox.event-1.6.100.jar, atomos_lib/org.eclipse.osgi-3.17.200.jar, atomos_lib/org.osgi.namespace.implementation-1.0.0.jar, atomos_lib/org.osgi.service.event-1.4.1.jar, atomos_lib/org.osgi.util.function-1.2.0.jar, atomos_lib/org.osgi.util.promise-1.2.0.jar, atomos_lib/osgi.annotation-8.1.0.jar, atomos_lib/osgi.core-8.0.0-AtomosEquinox.jar, org.apache.felix.atomos.Atomos
-
--class-path atomos_lib/
or--class-path atomos_lib
=>
Error: Main entry point class 'org.apache.felix.atomos.Atomos' neither found on the classpath nor on the modulepath.
classpath: '${PROJECT_DIR}\atomos_lib'
modulepath: '${GRAALVM_HOME}\lib\svm\library-support.jar'
The only option that works is to list every jar explicitly in the --class-path
option with the corresponding separator (;
on Windows and :
on Linux).
In the shared zip, I see 2 folders, one with generated config and the other with multiple jars. Could you please specify the steps to reproduce this issue?
- Unzip the shared zip in a directory (e.g. test)
- Open a commandline and switch to this directory
- Execute the following command:
${GRAALVM_HOME}\bin\native-image \
--no-fallback \
--module-path atomos_lib \
--add-modules ALL-MODULE-PATH \
--module org.apache.felix.atomos \
-H:ConfigurationFileDirectories=META-INF\native-image \
-H:+ReportUnsupportedElementsAtRuntime \
-H:+ReportExceptionStackTraces
This should be fixed in the new 22.3.0 release, could you please test it and confirm?
The error is gone, but the result is not the same as with running the native-image build using the classpath. Starting the application shows an exception. It doesn't seem to be really relevant, but it is different. See https://github.com/apache/felix-atomos/issues/68
$GRAALVM_HOME/bin/native-image \
--no-fallback \
--initialize-at-build-time=org.apache.felix.service.command.Converter \
--module-path atomos_lib \
--add-modules ALL-MODULE-PATH \
--module org.apache.felix.atomos \
-H:ConfigurationFileDirectories=native-image-resources \
-H:+ReportUnsupportedElementsAtRuntime \
-H:+ReportExceptionStackTraces \
atomos
The classpath command that is working without issues is:
$GRAALVM_HOME/bin/native-image \
--no-fallback \
--initialize-at-build-time=org.apache.felix.service.command.Converter \
--class-path atomos_lib/api-1.0.0-SNAPSHOT.jar:atomos_lib/benchmark-1.0.0-SNAPSHOT.jar:atomos_lib/command-1.0.0-SNAPSHOT.jar:atomos_lib/configurable-1.0.0-SNAPSHOT.jar:atomos_lib/eventhandler-1.0.0-SNAPSHOT.jar:atomos_lib/impl-1.0.0-SNAPSHOT.jar:atomos_lib/org.apache.felix.atomos-1.0.0.jar:atomos_lib/org.apache.felix.configadmin-1.9.24.jar:atomos_lib/org.apache.felix.gogo.command-1.1.2.jar:atomos_lib/org.apache.felix.gogo.runtime-1.1.6.jar:atomos_lib/org.apache.felix.gogo.shell-1.1.4.jar:atomos_lib/org.apache.felix.scr-2.2.0.jar:atomos_lib/org.eclipse.equinox.event-1.6.100.jar:atomos_lib/org.eclipse.osgi-3.17.200.jar:atomos_lib/org.osgi.namespace.implementation-1.0.0.jar:atomos_lib/org.osgi.service.event-1.4.1.jar:atomos_lib/org.osgi.util.function-1.2.0.jar:atomos_lib/org.osgi.util.promise-1.2.0.jar:atomos_lib/osgi.annotation-8.1.0.jar:atomos_lib/osgi.core-8.0.0-AtomosEquinox.jar \
-H:ConfigurationFileDirectories=native-image-resources \
-H:+ReportUnsupportedElementsAtRuntime \
-H:+ReportExceptionStackTraces \
org.apache.felix.atomos.Atomos \
atomos
The application is a small Gogo Shell commandline application. You can for example enter modify Test
and you will get some modified versions of the input printed to the console.
BTW, I am running the build on Windows 10 for the verification. Just in case this makes a difference. I updated the commands to Linux style to make it easier for you to reproduce it.
I also tried the following executions with the classpath option, that actually still don't work:
- classpath folder
$GRAALVM_HOME/bin/native-image \
--no-fallback \
--initialize-at-build-time=org.apache.felix.service.command.Converter \
--class-path atomos_lib \
-H:ConfigurationFileDirectories=native-image-resources \
-H:+ReportUnsupportedElementsAtRuntime \
-H:+ReportExceptionStackTraces \
org.apache.felix.atomos.Atomos \
atomos
Shows the following error:
Error: Main entry point class 'org.apache.felix.atomos.Atomos' neither found on the classpath nor on the modulepath.
classpath: 'xxx\graal_test\atomos_lib'
modulepath: '$GRAALVM_HOME\lib\svm\library-support.jar'
com.oracle.svm.core.util.UserError$UserException: Main entry point class 'org.apache.felix.atomos.Atomos' neither found on the classpath nor on the modulepath.
- classpath folder with asterisk
$GRAALVM_HOME/bin/native-image \
--no-fallback \
--initialize-at-build-time=org.apache.felix.service.command.Converter \
--class-path atomos_lib/* \
-H:ConfigurationFileDirectories=native-image-resources \
-H:+ReportUnsupportedElementsAtRuntime \
-H:+ReportExceptionStackTraces \
org.apache.felix.atomos.Atomos \
atomos
Shows the following error:
Error: Unknown arguments: atomos_lib\configurable-1.0.0-SNAPSHOT.jar, atomos_lib\eventhandler-1.0.0-SNAPSHOT.jar, atomos_lib\impl-1.0.0-SNAPSHOT.jar, atomos_lib\org.apache.felix.atomos-1.0.0.jar, atomos_lib\org.apache.felix.configadmin-1.9.24.jar, atomos_lib\org.apache.felix.gogo.command-1.1.2.jar, atomos_lib\org.apache.felix.gogo.runtime-1.1.6.jar, atomos_lib\org.apache.felix.gogo.shell-1.1.4.jar, atomos_lib\org.apache.felix.scr-2.2.0.jar, atomos_lib\org.eclipse.equinox.event-1.6.100.jar, atomos_lib\org.eclipse.osgi-3.17.200.jar, atomos_lib\org.osgi.namespace.implementation-1.0.0.jar, atomos_lib\org.osgi.service.event-1.4.1.jar, atomos_lib\org.osgi.util.function-1.2.0.jar, atomos_lib\org.osgi.util.promise-1.2.0.jar, atomos_lib\osgi.annotation-8.1.0.jar, atomos_lib\osgi.core-8.0.0-AtomosEquinox.jar, org.apache.felix.atomos.Atomos, atomos
As this seems to be a different problem, can you please create a new issue for it? this is not directly related to container so the appropriate place should be https://github.com/oracle/graal/issues I'll be closing this issue as resolved for now. Thank you.