Search code examples
mavenjavafxjava-native-interfacegluongluonfx

Why is my JavaFX 17 Application not building with Gluon ? Logged as JNI / Reflection problem


I am following the documentation given by Gluon : here.
To try to make it simple I'll try to go straight to the point giving the milestones I got through, and where I'm stuck.

--------- ENVIRONNEMENT :
OS : Windows 10 x64
IDE : Eclipse, Version: 2021-12 (4.22.0)
JAVA : jdk17.0.1
JAVAFX : javafx-sdk-17.0.1
GraalVM : graalvm-svm-java17-windows-gluon-22.0.0.2-Final
Gluon plugin for Eclipse : 2.8.2
Visual Studio : 1.63.2 (with all required extensions as described in document)
Wix : 3.11.2.24516

--------- CONFIGURATION
Maven : apache-maven-3.8.4
Pom : Here is an screenshot of the first part of my POM which can be found here.
enter image description here Environment Variables : JAVA_HOME + GRAALVM_HOME + MAVEN_HOME
enter image description here

--------- DONE :
JavaFX(v17) Application :

  • Running perfectly with direct RUN using regular JVM.
  • Running perfectly with javafx:compile as proposed in Gluon's documentation
    enter image description here

--------- PROBLEM :
Impossible to get the Gluon goal "mvn gluonfx:build" or "gluonfx:build" to complete! Here is what I do :

  1. As instructed to do here : "If you are running on Windows, you need to run all the GluonFX goals from a x64 terminal.", I open a "x64 Native Tools Command Prompt for VS 2022"
  2. Navigated to my project folder where the POM is.
  3. Runned the instruction mvn gluonfx:build. I also tried to follow the instruction suggesting to "open the Run Configurations…​ window and update the Goal to gluonfx:build and click Run". Both leads to a FAIL ! At the end of this post is the terminal report showing :
  • I do run with the option mentioned --allow-incomplete-classpath.
  • I do find the reported 'missing' cached_scope_id in the file jniconfig-x86_64-windows.json which is exactly on the mentioned path. Here is the file if needed.
    enter image description here

I am trying since days to turn around everything, and searched the net for some clues... But no luck until now :-(... Can anyone help me sort this out please ?

PS. I do use an external DLL (yes, Windows only, but hey : we are trying here to make a NATIVE build, thus, in Windows ;-), should be ok); This DLL is JNI attached. I tried to play around with this as well... No luck.

--------- TERMINAL REPORT :
(Full log as mentioned, here)

D:\_DEV\_Eclipse_IDE\_Workspaces\PRIVATE\GluonMobile_PlaylistProfiler>mvn gluonfx:build
[INFO] Scanning for projects...
[INFO]
[INFO] --< com.plpr.application:gluon-mobile---single-view-project--allow-incomplete-classpath >--
[INFO] Building Gluon Mobile - Single View Project 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- gluonfx-maven-plugin:1.0.8:build (default-cli) @ gluon-mobile---single-view-project--allow-incomplete-classpath ---
[INFO] Scanning for projects...
[INFO]
[INFO] --< com.plpr.application:gluon-mobile---single-view-project--allow-incomplete-classpath >--
[INFO] Building Gluon Mobile - Single View Project 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] >>> gluonfx-maven-plugin:1.0.8:compile (default-cli) > process-classes @ gluon-mobile---single-view-project--allow-incomplete-classpath >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ gluon-mobile---single-view-project--allow-incomplete-classpath ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ gluon-mobile---single-view-project--allow-incomplete-classpath ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] <<< gluonfx-maven-plugin:1.0.8:compile (default-cli) < process-classes @ gluon-mobile---single-view-project--allow-incomplete-classpath <<<
[INFO]
[INFO]
[INFO] --- gluonfx-maven-plugin:1.0.8:compile (default-cli) @ gluon-mobile---single-view-project--allow-incomplete-classpath ---
[lun. févr. 07 15:17:25 CET 2022][INFO] ==================== COMPILE TASK ====================
             _______  ___      __   __  _______  __    _
            |       ||   |    |  | |  ||       ||  |  | |
            |    ___||   |    |  | |  ||   _   ||   |_| |
            |   | __ |   |    |  |_|  ||  | |  ||       |
            |   ||  ||   |___ |       ||  |_|  ||  _    |
            |   |_| ||       ||       ||       || | |   |
            |_______||_______||_______||_______||_|  |__|

    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



[lun. févr. 07 15:17:26 CET 2022][INFO] We will now compile your code for x86_64-microsoft-windows. This may take some time.
[lun. févr. 07 15:17:28 CET 2022][INFO] [SUB] Warning: Ignoring server-mode native-image argument --no-server.
[lun. févr. 07 15:17:30 CET 2022][INFO] [SUB] ========================================================================================================================
[lun. févr. 07 15:17:30 CET 2022][INFO] [SUB] GraalVM Native Image: Generating 'com.plpr.application.gluonapplication'...
[lun. févr. 07 15:17:30 CET 2022][INFO] [SUB] ========================================================================================================================
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB] [1/7] Initializing...
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]                                                                                     (4,2s @ 0,16GB)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB] Error: Error parsing JNI configuration in D:\_DEV\_Eclipse_IDE\_Workspaces\PRIVATE\GluonMobile_PlaylistProfiler\target\gluonfx\x86_64-windows\gvm\jniconfig-x86_64-windows.json:
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB] Field java.net.Inet6Address.cached_scope_id not found. To allow unresolvable reflection configuration, use option --allow-incomplete-classpath
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB] Verify that the configuration matches the schema described in the -H:PrintFlags=+ output for option JNIConfigurationFiles.
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB] com.oracle.svm.core.util.UserError$UserException: Error parsing JNI configuration in D:\_DEV\_Eclipse_IDE\_Workspaces\PRIVATE\GluonMobile_PlaylistProfiler\target\gluonfx\x86_64-windows\gvm\jniconfig-x86_64-windows.json:
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB] Field java.net.Inet6Address.cached_scope_id not found. To allow unresolvable reflection configuration, use option --allow-incomplete-classpath
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB] Verify that the configuration matches the schema described in the -H:PrintFlags=+ output for option JNIConfigurationFiles.
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at com.oracle.svm.core.util.UserError.abort(UserError.java:73)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at com.oracle.svm.hosted.config.ConfigurationParserUtils.doParseAndRegister(ConfigurationParserUtils.java:135)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at com.oracle.svm.hosted.config.ConfigurationParserUtils.lambda$parseAndRegisterConfigurations$1(ConfigurationParserUtils.java:86)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at java.base/java.util.stream.ReferencePipeline$4$1.accept(ReferencePipeline.java:214)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at java.base/java.util.stream.StreamSpliterators$WrappingSpliterator.forEachRemaining(StreamSpliterators.java:310)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at java.base/java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:734)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at java.base/java.util.stream.IntPipeline.reduce(IntPipeline.java:515)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at java.base/java.util.stream.IntPipeline.sum(IntPipeline.java:473)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at com.oracle.svm.hosted.config.ConfigurationParserUtils.parseAndRegisterConfigurations(ConfigurationParserUtils.java:88)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at com.oracle.svm.jni.access.JNIAccessFeature.afterRegistration(JNIAccessFeature.java:128)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at com.oracle.svm.hosted.NativeImageGenerator.lambda$setupNativeImage$14(NativeImageGenerator.java:802)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:74)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at com.oracle.svm.hosted.NativeImageGenerator.setupNativeImage(NativeImageGenerator.java:802)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:534)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:494)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:426)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:587)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:126)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]   at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:617)
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB] ------------------------------------------------------------------------------------------------------------------------
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]                          0,1s (3,0% of total time) in 8 GCs | Peak RSS: 0,85GB | CPU load: 5,50
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB] ------------------------------------------------------------------------------------------------------------------------
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB] Produced artifacts:
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB]  D:\_DEV\_Eclipse_IDE\_Workspaces\PRIVATE\GluonMobile_PlaylistProfiler\target\gluonfx\x86_64-windows\gvm\Gluon Mobile - Single View Project\com.plpr.application.gluonapplication.build_artifacts.txt
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB] ========================================================================================================================
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB] Failed generating 'com.plpr.application.gluonapplication' after 2,3s.
[lun. févr. 07 15:17:31 CET 2022][INFO] [SUB] Error: Image build request failed with exit status 1
[lun. févr. 07 15:17:31 CET 2022][SEVERE] Process compile failed with result: 1
Check the log files under D:\_DEV\_Eclipse_IDE\_Workspaces\PRIVATE\GluonMobile_PlaylistProfiler\target\gluonfx\x86_64-windows\gvm\log
And please check https://docs.gluonhq.com/ for more information.
[lun. févr. 07 15:17:31 CET 2022][INFO] Logging process [compile] to file: D:\_DEV\_Eclipse_IDE\_Workspaces\PRIVATE\GluonMobile_PlaylistProfiler\target\gluonfx\log\process-compile-1644243451215.log
[lun. févr. 07 15:17:31 CET 2022][SEVERE] Compiling failed.
Check the log files under D:\_DEV\_Eclipse_IDE\_Workspaces\PRIVATE\GluonMobile_PlaylistProfiler\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:  6.934 s
[INFO] Finished at: 2022-02-07T15:17:31+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.gluonhq:gluonfx-maven-plugin:1.0.8:compile (default-cli) on project gluon-mobile---single-view-project--allow-incomplete-classpath: 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:  8.723 s
[INFO] Finished at: 2022-02-07T15:17:31+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.gluonhq:gluonfx-maven-plugin:1.0.8:build (default-cli) on project gluon-mobile---single-view-project--allow-incomplete-classpath: 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

Solution

  • José Pereda, which has an amazing 'Coding Blog' here, spotted that my plugin version was outdated.
    He pointed out that there are 2 plugins used in the development process :

    • The IDE one, in my case Eclipse, which the latest as of 2022.02.08, is 2.8.2.
    • The 'POM' one, which was set by default to 1.0.8, and I had to set as 1.0.12.
      That solved the problem described in my question. Here is a screenshot of the updated POM, which can be found here :
      enter image description here

      Another issue I found was my custom argument --allow-incomplete-classpath for the native build was set incorrectly. It has to be set in the 'POM' in the plugin/configuration section as follows (same POM referenced already) :
      enter image description here

      These 2 modifications allowed me to have a completed build, and my 'exe' file was created !