I'm running my java application with graalvm windows native mode. Here is the error that i get all the times. I can run this code with openjdk and is working fine. The only issue that i face is when i'm building windows native image. I'm using gluonfx maven plugin for building the native image. Here is the output that i'm getting.
[INFO] from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] >>> gluonfx-maven-plugin:1.0.21:compile (default-cli) > process-classes @ tgut >>>
[INFO]
[INFO] --- maven-enforcer-plugin:3.0.0-M3:enforce (default-build) @ tgut ---
[INFO]
[INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) @ tgut ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] Copying 54 resources
[INFO] Copying 17 resources
[INFO] The encoding used to copy filtered properties files have not been set. This means that the same encoding will be used to copy filtered properties files as when copying other filtered resources. This might not be what you want! Run your build with --debug to see which files might be affected. Read more at https://maven.apache.org/plugins/maven-resources-plugin/examples/filtering-properties-files.html
[INFO]
[INFO] --- maven-compiler-plugin:3.10.1:compile (default-compile) @ tgut ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 224 source files to C:\Users\C_ZU\IdeaProjects\33.96.7330\target\classes
[INFO] /C:/Users/C_ZU/IdeaProjects/33.96.7330/src/main/java/com/abc/xyz/test/applicationlauncher/TgutApplication.java: C:\Users\C_ZU\IdeaProjects\33.96.7330\src\main\java\com\abc\xyz\test\applicationlauncher\TgutApplication.java uses unchecked or unsafe operations.
[INFO] /C:/Users/C_ZU/IdeaProjects/33.96.7330/src/main/java/com/abc/xyz/test/applicationlauncher/TgutApplication.java: Recompile with -Xlint:unchecked for details.
[INFO]
[INFO] --- micronaut-maven-plugin:3.2.3:aot-analysis (default-aot-analysis) @ tgut ---
[INFO]
[INFO] <<< gluonfx-maven-plugin:1.0.21:compile (default-cli) < process-classes @ tgut <<<
[INFO]
[INFO]
[INFO] --- gluonfx-maven-plugin:1.0.21:compile (default-cli) @ tgut ---
[Fri Jan 26 14:49:28 CET 2024][INFO] ==================== COMPILE TASK ====================
_______ ___ __ __ _______ __ _
[Fri Jan 26 14:49:28 CET 2024][INFO] We will now compile your code for x86_64-microsoft-windows. This may take some time.
| || | | | | || || | | |
| ___|| | | | | || _ || |_| |
| | __ | | | |_| || | | || |
| || || |___ | || |_| || _ |
| |_| || || || || | | |
|_______||_______||_______||_______||_| |__|
Access to the latest docs, tips and tricks and more info on
how to get support? Register your usage of Gluon Substrate now at
https://gluonhq.com/activate
[Fri Jan 26 14:49:41 CET 2024][INFO] [SUB] Warning: Ignoring server-mode native-image argument --no-server.
[Fri Jan 26 14:49:41 CET 2024][INFO] [SUB] Warning: Using a deprecated option --allow-incomplete-classpath from 'META-INF\native-image\io.micronaut\micronaut-inject\native-image.properties' in 'file:///C:/Users/C_ZU/IdeaProjects/33.96.7330/target/gluonfx/x86_64-windows/gvm/tmp/deps/micronaut-inject-3.4.2.jar'. Allowing an incomplete classpath is now the default. Use --link-at-build-time to report linking errors at image build time for a class or package.
[Fri Jan 26 14:50:02 CET 2024][INFO] [SUB] ========================================================================================================================
[Fri Jan 26 14:50:02 CET 2024][INFO] [SUB] GraalVM Native Image: Generating 'com.abc.xyz.test.test' (shared library)...
[Fri Jan 26 14:50:02 CET 2024][INFO] [SUB] ========================================================================================================================
[Fri Jan 26 14:50:04 CET 2024][INFO] [SUB] Warning: Could not resolve com.sun.jna.Callback for reflection configuration. Reason: java.lang.ClassNotFoundException: com.sun.jna.Callback.
[Fri Jan 26 14:50:04 CET 2024][INFO] [SUB] Warning: Could not resolve com.sun.jna.CallbackReference for reflection configuration. Reason: java.lang.ClassNotFoundException: com.sun.jna.CallbackReference.
[Fri Jan 26 14:50:04 CET 2024][INFO] [SUB] Warning: Could not resolve com.sun.jna.CallbackReference$AttachOptions for reflection configuration. Reason: java.lang.ClassNotFoundException: com.sun.jna.CallbackReference$AttachOptions.
[Fri Jan 26 14:50:04 CET 2024][INFO] [SUB] Warning: Could not resolve com.sun.jna.FromNativeConverter for reflection configuration. Reason: java.lang.ClassNotFoundException: com.sun.jna.FromNativeConverter.
[Fri Jan 26 14:50:04 CET 2024][INFO] [SUB] Warning: Could not resolve com.sun.jna.IntegerType for reflection configuration. Reason: java.lang.ClassNotFoundException: com.sun.jna.IntegerType.
[Fri Jan 26 14:50:04 CET 2024][INFO] [SUB] Warning: Could not resolve com.sun.jna.JNIEnv for reflection configuration. Reason: java.lang.ClassNotFoundException: com.sun.jna.JNIEnv.
[Fri Jan 26 14:50:04 CET 2024][INFO] [SUB] Warning: Could not resolve com.sun.jna.Native for reflection configuration. Reason: java.lang.ClassNotFoundException: com.sun.jna.Native.
[Fri Jan 26 14:50:04 CET 2024][INFO] [SUB] Warning: Could not resolve com.sun.jna.Native$ffi_callback for reflection configuration. Reason: java.lang.ClassNotFoundException: com.sun.jna.Native$ffi_callback.
[Fri Jan 26 14:50:04 CET 2024][INFO] [SUB] Warning: Could not resolve com.sun.jna.NativeMapped for reflection configuration. Reason: java.lang.ClassNotFoundException: com.sun.jna.NativeMapped.
[Fri Jan 26 14:50:04 CET 2024][INFO] [SUB] Warning: Could not resolve com.sun.jna.Pointer for reflection configuration. Reason: java.lang.ClassNotFoundException: com.sun.jna.Pointer.
[Fri Jan 26 14:50:04 CET 2024][INFO] [SUB] Warning: Could not resolve com.sun.jna.PointerType for reflection configuration. Reason: java.lang.ClassNotFoundException: com.sun.jna.PointerType.
[Fri Jan 26 14:50:04 CET 2024][INFO] [SUB] Warning: Could not resolve com.sun.jna.Structure for reflection configuration. Reason: java.lang.ClassNotFoundException: com.sun.jna.Structure.
[Fri Jan 26 14:50:04 CET 2024][INFO] [SUB] Warning: Could not resolve com.sun.jna.Structure$ByValue for reflection configuration. Reason: java.lang.ClassNotFoundException: com.sun.jna.Structure$ByValue.
[Fri Jan 26 14:50:04 CET 2024][INFO] [SUB] Warning: Could not resolve com.sun.jna.Structure$FFIType$FFITypes for reflection configuration. Reason: java.lang.ClassNotFoundException: com.sun.jna.Structure$FFIType$FFITypes.
[Fri Jan 26 14:50:04 CET 2024][INFO] [SUB] Warning: Could not resolve com.sun.jna.WString for reflection configuration. Reason: java.lang.ClassNotFoundException: com.sun.jna.WString.
[Fri Jan 26 14:50:04 CET 2024][INFO] [SUB] Warning: Could not resolve sun.awt.X11.XDesktopPeer for reflection configuration. Reason: java.lang.ClassNotFoundException: sun.awt.X11.XDesktopPeer.
[Fri Jan 26 14:50:04 CET 2024][INFO] [SUB] Warning: Could not resolve sun.awt.X11.XErrorHandlerUtil for reflection configuration. Reason: java.lang.ClassNotFoundException: sun.awt.X11.XErrorHandlerUtil.
[Fri Jan 26 14:50:04 CET 2024][INFO] [SUB] Warning: Could not resolve sun.awt.X11.XToolkit for reflection configuration. Reason: java.lang.ClassNotFoundException: sun.awt.X11.XToolkit.
[Fri Jan 26 14:50:04 CET 2024][INFO] [SUB] Warning: Could not resolve sun.awt.X11GraphicsDevice for reflection configuration. Reason: java.lang.ClassNotFoundException: sun.awt.X11GraphicsDevice.
[Fri Jan 26 14:50:04 CET 2024][INFO] [SUB] Warning: Could not resolve sun.java2d.xr.XRSurfaceData for reflection configuration. Reason: java.lang.ClassNotFoundException: sun.java2d.xr.XRSurfaceData.
[Fri Jan 26 14:50:05 CET 2024][INFO] [SUB]
[Fri Jan 26 14:50:05 CET 2024][INFO] [SUB] [1/7] Initializing... (0.0s @ 0.75GB)
[Fri Jan 26 14:50:05 CET 2024][INFO] [SUB] Error: ImageSingletons.add must not overwrite existing key com.oracle.svm.core.jdk.ProtectionDomainSupport
[Fri Jan 26 14:50:05 CET 2024][INFO] [SUB] Existing value: com.oracle.svm.core.jdk.ProtectionDomainSupport@12166229
[Fri Jan 26 14:50:05 CET 2024][INFO] [SUB] New value: com.oracle.svm.core.jdk.ProtectionDomainSupport@208e5b23
[Fri Jan 26 14:50:05 CET 2024][INFO] [SUB] com.oracle.svm.core.util.UserError$UserException: ImageSingletons.add must not overwrite existing key com.oracle.svm.core.jdk.ProtectionDomainSupport
[Fri Jan 26 14:50:05 CET 2024][INFO] [SUB] Existing value: com.oracle.svm.core.jdk.ProtectionDomainSupport@12166229
[Fri Jan 26 14:50:05 CET 2024][INFO] [SUB] New value: com.oracle.svm.core.jdk.ProtectionDomainSupport@208e5b23
[Fri Jan 26 14:50:05 CET 2024][INFO] [SUB] at com.oracle.svm.core.util.UserError.abort(UserError.java:72)
[Fri Jan 26 14:50:05 CET 2024][INFO] [SUB] at com.oracle.svm.hosted.ImageSingletonsSupportImpl$HostedManagement.doAdd(ImageSingletonsSupportImpl.java:109)
[Fri Jan 26 14:50:05 CET 2024][INFO] [SUB] at com.oracle.svm.hosted.ImageSingletonsSupportImpl.add(ImageSingletonsSupportImpl.java:39)
[Fri Jan 26 14:50:05 CET 2024][INFO] [SUB] at org.graalvm.sdk/org.graalvm.nativeimage.ImageSingletons.add(ImageSingletons.java:73)
[Fri Jan 26 14:50:05 CET 2024][INFO] [SUB] at com.oracle.svm.hosted.ProtectionDomainFeature.afterRegistration(ProtectionDomainFeature.java:48)
[Fri Jan 26 14:50:05 CET 2024][INFO] [SUB] at com.oracle.svm.hosted.NativeImageGenerator.lambda$setupNativeImage$14(NativeImageGenerator.java:832)
[Fri Jan 26 14:50:05 CET 2024][INFO] [SUB] at com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:74)
[Fri Jan 26 14:50:05 CET 2024][INFO] [SUB] at com.oracle.svm.hosted.NativeImageGenerator.setupNativeImage(NativeImageGenerator.java:832)
[Fri Jan 26 14:50:05 CET 2024][INFO] [SUB] at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:555)
[Fri Jan 26 14:50:05 CET 2024][INFO] [SUB] at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:515)
[Fri Jan 26 14:50:05 CET 2024][INFO] [SUB] at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:407)
[Fri Jan 26 14:50:05 CET 2024][INFO] [SUB] at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:585)
[Fri Jan 26 14:50:05 CET 2024][INFO] [SUB] at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:128)
[Fri Jan 26 14:50:05 CET 2024][INFO] [SUB] at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:615)
[Fri Jan 26 14:50:05 CET 2024][INFO] [SUB] ------------------------------------------------------------------------------------------------------------------------
[Fri Jan 26 14:50:05 CET 2024][INFO] [SUB] 1.8s (7.9% of total time) in 17 GCs | Peak RSS: 1.41GB | CPU load: 4.65
[Fri Jan 26 14:50:05 CET 2024][INFO] [SUB] ========================================================================================================================
[Fri Jan 26 14:50:05 CET 2024][INFO] [SUB] Failed generating 'com.abc.xyz.test.test' after 20.4s.
[Fri Jan 26 14:50:05 CET 2024][INFO] [SUB] Error: Image build request failed with exit status 1
[Fri Jan 26 14:50:05 CET 2024][SEVERE] Process compile failed with result: 1
Check the log files under C:\Users\C_ZU\IdeaProjects\33.96.7330\target\gluonfx\x86_64-windows\gvm\log
And please check https://docs.gluonhq.com/ for more information.
[Fri Jan 26 14:50:05 CET 2024][INFO] Logging process [compile] to file: C:\Users\C_ZU\IdeaProjects\33.96.7330\target\gluonfx\log\process-compile-1706277005681.log
[Fri Jan 26 14:50:05 CET 2024][SEVERE] Compiling failed.
Check the log files under C:\Users\C_ZU\IdeaProjects\33.96.7330\target\gluonfx\x86_64-windows\gvm\log
And please check https://docs.gluonhq.com/ for more information.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:17 min
[INFO] Finished at: 2024-01-26T14:50:05+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.gluonhq:gluonfx-maven-plugin:1.0.21:compile (default-cli) on project tgut: Compiling failed -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:28 min
[INFO] Finished at: 2024-01-26T14:50:06+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.gluonhq:gluonfx-maven-plugin:1.0.21:build (default-cli) on project tgut: Error, gluonfx:build failed -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
C:\Users\C_ZU\IdeaProjects\33.96.7330>java --version
openjdk 11.0.15 2022-04-19
OpenJDK Runtime Environment GraalVM 22.1.0.1 (build 11.0.15+10-jvmci-22.1-b06)
OpenJDK 64-Bit Server VM GraalVM 22.1.0.1 (build 11.0.15+10-jvmci-22.1-b06, mixed mode, sharing)
C:\Users\C_ZU\IdeaProjects\33.96.7330>
As in specified in logs we are using gluonhq/graal version 21.1.0.1final, with openjdk 11.0.5. The gluonfx version is 1.0.21, I have tried it with 1.0.22, but getting the same error.
In order to use gluonhq/graal version 21.1.0.1final we have to use jdk17 minimum. As in the table at https://gluonhq.com/products/javafx/
If you have to use jdk11 you need to use 19.0.2.1