Our app was already using GluonFX 1.0.12. And we were able to build APK (with OpenJDK 11).
I've updated the GluonFX to 1.0.16 now. I am able to run the app. And running the app through mvn gluonfx:runagent goal is also working fine. But building using mvn gluonfx:build gluonfx:package -Pandroid results in error.
So I generated a sample project from start.gluon.io and tried to build APK with same configuration, and it also failed returing same error, as shown below.
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] [1/7] Initializing... (0.0s # 0.13GB)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] Fatal error: java.lang.UnsupportedClassVersionError: javafx/application/Application has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at java.base/java.lang.ClassLoader.defineClass1(Native Method)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:555)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:458)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:452)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at java.base/java.security.AccessController.doPrivileged(Native Method)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:451)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at java.base/java.lang.ClassLoader.defineClass1(Native Method)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:555)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:458)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:452)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at java.base/java.security.AccessController.doPrivileged(Native Method)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:451)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at java.base/java.lang.Class.forName0(Native Method)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at java.base/java.lang.Class.forName(Class.java:398)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at com.oracle.svm.hosted.ImageClassLoader.forName(ImageClassLoader.java:291)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at com.oracle.svm.hosted.ImageClassLoader.forName(ImageClassLoader.java:287)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at com.oracle.svm.hosted.ImageClassLoader.forName(ImageClassLoader.java:296)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:343)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:585)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:128)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:615)
[Wed Dec 28 15:02:03 IST 2022][INFO] [SUB] Error: Image build request failed with exit status 1
[Wed Dec 28 15:02:03 IST 2022][FINE] Result for compile: 1
[Wed Dec 28 15:02:03 IST 2022][SEVERE] Process compile failed with result: 1
Check the log files under /home/manikandan/git/hellojavafx/target/gluonfx/aarch64-android/gvm/log
And please check https://docs.gluonhq.com/ for more information.
[Wed Dec 28 15:02:03 IST 2022][INFO] Logging process [compile] to file: /home/manikandan/git/hellojavafx/target/gluonfx/log/process-compile-1672219923249.log
[Wed Dec 28 15:02:03 IST 2022][SEVERE] Compiling failed.
Check the log files under /home/manikandan/git/hellojavafx/target/gluonfx/aarch64-android/gvm/log
And please check https://docs.gluonhq.com/ for more information.
Complete log can be found here
Here's the pom.xml file.
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.manikandan</groupId>
<artifactId>myapplication</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>HelloJavafx</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.release>11</maven.compiler.release>
<javafx.version>19</javafx.version>
<javafx.plugin.version>0.0.8</javafx.plugin.version>
<gluonfx.plugin.version>1.0.16</gluonfx.plugin.version>
<main.class>com.manikandan.sample.Main</main.class>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-base</artifactId>
<version>${javafx.version}</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-graphics</artifactId>
<version>${javafx.version}</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>${javafx.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>${javafx.plugin.version}</version>
<configuration>
<mainClass>${main.class}</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>com.gluonhq</groupId>
<artifactId>gluonfx-maven-plugin</artifactId>
<version>${gluonfx.plugin.version}</version>
<configuration>
<target>${gluonfx.target}</target>
<mainClass>${main.class}</mainClass>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>android</id>
<properties>
<gluonfx.target>android</gluonfx.target>
</properties>
</profile>
<profile>
<id>ios</id>
<properties>
<gluonfx.target>ios</gluonfx.target>
</properties>
</profile>
</profiles>
</project>
I am using OpenJDK 11.0,14.
manikandan#manikandan-VirtualBox:~/git/hellojavafx$ java -version
openjdk version "11.0.14.1" 2022-02-08
OpenJDK Runtime Environment (build 11.0.14.1+1-Ubuntu-0ubuntu1.20.04)
OpenJDK 64-Bit Server VM (build 11.0.14.1+1-Ubuntu-0ubuntu1.20.04, mixed mode, sharing)
And I am using graalvm-svm-java11-linux-gluon-22.1.0.1-Final.
manikandan#manikandan-VirtualBox:~/git/hellojavafx$ echo $GRAALVM_HOME
/media/sf_linux_softwares/graalvm-svm-java11-linux-gluon-22.1.0.1-Final
Please let me know what is the cause of this error?
Update 1:-
As suggested, I've added javafxStaticSdkVersion-19 to gluonfx configuration.
<plugin>
<groupId>com.gluonhq</groupId>
<artifactId>gluonfx-maven-plugin</artifactId>
<version>${gluonfx.plugin.version}</version>
<configuration>
<target>${gluonfx.target}</target>
<mainClass>${main.class}</mainClass>
<javafxStaticSdkVersion>19</javafxStaticSdkVersion>
</configuration>
</plugin>
But now the build fails at linking stage.
[Thu Dec 29 11:13:04 IST 2022][INFO] ==================== LINK TASK ====================
[Thu Dec 29 11:13:07 IST 2022][INFO] [SUB] /media/sf_linux_softwares/android-ndk-r21b/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: unrecognized option '--rosegment'
[Thu Dec 29 11:13:07 IST 2022][INFO] [SUB] /media/sf_linux_softwares/android-ndk-r21b/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: use the --help option for usage information
[Thu Dec 29 11:13:07 IST 2022][INFO] [SUB] clang++: error: linker command failed with exit code 1 (use -v to see invocation)
[Thu Dec 29 11:13:07 IST 2022][SEVERE] Process link failed with result: 1
Check the log files under /home/manikandan/git/hellojavafx/target/gluonfx/aarch64-android/gvm/log
And please check https://docs.gluonhq.com/ for more information.
[Thu Dec 29 11:13:07 IST 2022][INFO] Logging process [link] to file: /home/manikandan/git/hellojavafx/target/gluonfx/log/process-link-1672292587129.log
[Thu Dec 29 11:13:07 IST 2022][SEVERE] Linking failed.
Check the log files under /home/manikandan/git/hellojavafx/target/gluonfx/aarch64-android/gvm/log
And please check https://docs.gluonhq.com/ for more information.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 06:35 min
[INFO] Finished at: 2022-12-29T11:13:07+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.gluonhq:gluonfx-maven-plugin:1.0.16:link (default-cli) on project myapplication: Linking failed -> [Help 1]
I am using android-ndk-r21b. Does gluonfx 1.0.16 require latest version of ndk ?
Update2:-
I let the plugin download the SDK, and I separately downloaded NDK r25b and updated PATH of 'ANDROID_NDK'
Now the build fails with "error: 127, clang not found" (shown below)
[Fri Dec 30 16:46:09 IST 2022][INFO] ==================== COMPILE TASK ====================
[Fri Dec 30 16:46:11 IST 2022][INFO] We will now compile your code for aarch64-linux-android. This may take some time.
[Fri Dec 30 16:46:11 IST 2022][FINE] Extracting native libs to: /home/manikandan/git/hellojavafx/target/gluonfx/aarch64-android/gvm/lib
[Fri Dec 30 16:46:11 IST 2022][FINE] Looking for resource: /native/android/c/dummy.c
[Fri Dec 30 16:46:11 IST 2022][FINE] Looking for resource: /native/android/c/launcher.c
[Fri Dec 30 16:46:11 IST 2022][FINE] Looking for resource: /native/android/c/javafx_adapter.c
[Fri Dec 30 16:46:11 IST 2022][FINE] Looking for resource: /native/android/c/touch_events.c
[Fri Dec 30 16:46:11 IST 2022][FINE] Looking for resource: /native/android/c/glibc_shim.c
[Fri Dec 30 16:46:11 IST 2022][FINE] Looking for resource: /native/android/c/attach_adapter.c
[Fri Dec 30 16:46:11 IST 2022][FINE] Looking for resource: /native/android/c/logger.c
[Fri Dec 30 16:46:11 IST 2022][FINE] Looking for resource: /native/android/c/grandroid.h
[Fri Dec 30 16:46:11 IST 2022][FINE] Looking for resource: /native/android/c/grandroid_ext.h
[Fri Dec 30 16:46:11 IST 2022][FINE] PB Command for compile-additional-sources: /media/sf_linux_softwares/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -c -DSUBSTRATE -target aarch64-linux-android -I. -fPIC -I/home/manikandan/git/hellojavafx/target/gluonfx/aarch64-android/gvm/HelloJavafx dummy.c launcher.c javafx_adapter.c touch_events.c glibc_shim.c attach_adapter.c logger.c
[Fri Dec 30 16:46:11 IST 2022][FINE] Start process compile-additional-sources...
[Fri Dec 30 16:46:11 IST 2022][FINE] [SUB] /media/sf_linux_softwares/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang: 1: clang-14: not found
[Fri Dec 30 16:46:11 IST 2022][FINE] Result for compile-additional-sources: 127
[Fri Dec 30 16:46:11 IST 2022][SEVERE] Process compile-additional-sources failed with result: 127
Check the log files under /home/manikandan/git/hellojavafx/target/gluonfx/aarch64-android/gvm/log
And please check https://docs.gluonhq.com/ for more information.
[Fri Dec 30 16:46:11 IST 2022][INFO] Logging process [compile-additional-sources] to file: /home/manikandan/git/hellojavafx/target/gluonfx/log/process-compile-additional-sources-1672398971174.log
[Fri Dec 30 16:46:11 IST 2022][SEVERE] Compiling failed.
Check the log files under /home/manikandan/git/hellojavafx/target/gluonfx/aarch64-android/gvm/log
And please check https://docs.gluonhq.com/ for more information.
But I checked the directory specified in error log, and clang-14 is there.
How to handle this error ?
I have built a native image application using (GraalVM 22.1.0) in Mac OS environment and it worked, but when trying to build the same application on linux the gluonfx:links fails, with an error of
undefined reference to Java_com_sun_security_auth_module_UnixSystem_getUnixInfo
undefined reference to JNI_OnLoad_jaas
I thought the problem was the libjaas.a not linking as it was not presented in the log file, so i added <arg>-ljaas</arg> but gave me another error which was /usr/bin/ld: cannot find -ljaas
Here is the POM file:
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<junit.version>5.8.1</junit.version>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>17.0.1</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>17.0.1</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>2.1.214</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>17</source>
<target>17</target>
</configuration>
</plugin>
<plugin>
<groupId>com.gluonhq</groupId>
<artifactId>gluonfx-maven-plugin</artifactId>
<version>1.0.15</version>
<configuration>
<mainClass>com.example.demo4.Driver</mainClass>
<linkerArgs>
<arg>-ljaas</arg>
</linkerArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.8</version>
<executions>
<execution>
<!-- Default configuration for running with: mvn clean javafx:run -->
<id>default-cli</id>
<configuration>
<mainClass>com.example.demo4/com.example.demo4.HelloApplication</mainClass>
<launcher>app</launcher>
<jlinkZipName>app</jlinkZipName>
<jlinkImageName>app</jlinkImageName>
<noManPages>true</noManPages>
<stripDebug>true</stripDebug>
<noHeaderFiles>true</noHeaderFiles>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Main Class:
package com.example.demo4;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.stage.Stage;
import java.sql.*;
public class Driver extends Application {
#Override
public void start(Stage stage) throws Exception {
Class.forName("org.h2.Driver");
Connection connection =DriverManager.getConnection("","","");
String str = connection.toString();
connection.close();
Scene scene = new Scene(new Label(str),500,500);
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}
Error gluonfx:link
[Mon Sep 05 11:37:26 EEST 2022][INFO] We will now compile your code for x86_64-linux-linux. This may take some time.
[Mon Sep 05 11:37:27 EEST 2022][INFO] [SUB] Warning: Ignoring server-mode native-image argument --no-server.
[Mon Sep 05 11:37:29 EEST 2022][INFO] [SUB] ========================================================================================================================
[Mon Sep 05 11:37:29 EEST 2022][INFO] [SUB] GraalVM Native Image: Generating 'com.example.demo4.driver' (shared library)...
[Mon Sep 05 11:37:29 EEST 2022][INFO] [SUB] ========================================================================================================================
[Mon Sep 05 11:37:29 EEST 2022][INFO] [SUB] [GluonFeature] enabled for config com.oracle.svm.hosted.FeatureImpl$IsInConfigurationAccessImpl#7cc586a8
[Mon Sep 05 11:37:30 EEST 2022][INFO] [SUB] GluonFeature enabled in setup com.oracle.svm.hosted.FeatureImpl$DuringSetupAccessImpl#65f58c6e
[Mon Sep 05 11:37:31 EEST 2022][INFO] [SUB] [1/7] Initializing... (3.7s # 0.20GB)
[Mon Sep 05 11:37:31 EEST 2022][INFO] [SUB] Version info: 'GraalVM 22.1.0 Java 17 CE'
[Mon Sep 05 11:37:31 EEST 2022][INFO] [SUB] C compiler: gcc (linux, x86_64, 9.3.0)
[Mon Sep 05 11:37:31 EEST 2022][INFO] [SUB] Garbage collector: Serial GC
[Mon Sep 05 11:37:31 EEST 2022][INFO] [SUB] 1 user-provided feature(s)
[Mon Sep 05 11:37:31 EEST 2022][INFO] [SUB] - com.gluonhq.substrate.feature.GluonFeature
[Mon Sep 05 11:38:17 EEST 2022][INFO] [SUB] [2/7] Performing analysis... [***********] (45.6s # 3.08GB)
[Mon Sep 05 11:38:17 EEST 2022][INFO] [SUB] 13,299 (91.34%) of 14,560 classes reachable
[Mon Sep 05 11:38:17 EEST 2022][INFO] [SUB] 25,151 (67.63%) of 37,189 fields reachable
[Mon Sep 05 11:38:17 EEST 2022][INFO] [SUB] 70,391 (66.36%) of 106,070 methods reachable
[Mon Sep 05 11:38:17 EEST 2022][INFO] [SUB] 663 classes, 185 fields, and 2,147 methods registered for reflection
[Mon Sep 05 11:38:17 EEST 2022][INFO] [SUB] 114 classes, 144 fields, and 182 methods registered for JNI access
[Mon Sep 05 11:38:20 EEST 2022][INFO] [SUB] [3/7] Building universe... (3.2s # 2.60GB)
[Mon Sep 05 11:38:23 EEST 2022][INFO] [SUB] [4/7] Parsing methods... [**] (3.0s # 3.00GB)
[Mon Sep 05 11:38:30 EEST 2022][INFO] [SUB] [5/7] Inlining methods... [****] (6.2s # 2.27GB)
[Mon Sep 05 11:39:03 EEST 2022][INFO] [SUB] [6/7] Compiling methods... [******] (32.8s # 3.51GB)
[Mon Sep 05 11:39:11 EEST 2022][INFO] [SUB]
[Mon Sep 05 11:39:11 EEST 2022][INFO] [SUB] ------------------------------------------------------------------------------------------------------------------------
[Mon Sep 05 11:39:11 EEST 2022][INFO] [SUB] 10.0s (9.6% of total time) in 59 GCs | Peak RSS: 5.27GB | CPU load: 6.42
[Mon Sep 05 11:39:11 EEST 2022][INFO] [SUB] ------------------------------------------------------------------------------------------------------------------------
[Mon Sep 05 11:39:11 EEST 2022][INFO] [SUB] Produced artifacts:
[Mon Sep 05 11:39:11 EEST 2022][INFO] [SUB] /home/yousef66/Desktop/demo4/target/gluonfx/x86_64-linux/gvm/demo4/graal_isolate.h (header)
[Mon Sep 05 11:39:11 EEST 2022][INFO] [SUB] /home/yousef66/Desktop/demo4/target/gluonfx/x86_64-linux/gvm/demo4/com.example.demo4.driver.h (header)
[Mon Sep 05 11:39:11 EEST 2022][INFO] [SUB] /home/yousef66/Desktop/demo4/target/gluonfx/x86_64-linux/gvm/demo4/graal_isolate_dynamic.h (header)
[Mon Sep 05 11:39:11 EEST 2022][INFO] [SUB] /home/yousef66/Desktop/demo4/target/gluonfx/x86_64-linux/gvm/demo4/com.example.demo4.driver_dynamic.h (header)
[Mon Sep 05 11:39:11 EEST 2022][INFO] [SUB] /home/yousef66/Desktop/demo4/target/gluonfx/x86_64-linux/gvm/demo4/com.example.demo4.driver.build_artifacts.txt
[Mon Sep 05 11:39:11 EEST 2022][INFO] [SUB] ========================================================================================================================
[Mon Sep 05 11:39:11 EEST 2022][INFO] [SUB] Finished generating 'com.example.demo4.driver' in 1m 43s.
[INFO]
[INFO] --- gluonfx-maven-plugin:1.0.15:link (default-cli) # demo4 ---
[Mon Sep 05 11:39:12 EEST 2022][INFO] Substrate is tested with the Gluon's GraalVM build which you can find at https://github.com/gluonhq/graal/releases.
While you can still use other GraalVM builds, there is no guarantee that these will work properly with Substrate
[Mon Sep 05 11:39:12 EEST 2022][INFO] ==================== LINK TASK ====================
[Mon Sep 05 11:39:13 EEST 2022][INFO] [SUB] /usr/bin/ld: /home/yousef66/Desktop/demo4/target/gluonfx/x86_64-linux/gvm/tmp/SVM-1662367049997/com.example.demo4.driver.o:(.data+0x6d8): undefined reference to `JNI_OnLoad_jaas'
[Mon Sep 05 11:39:13 EEST 2022][INFO] [SUB] /usr/bin/ld: /home/yousef66/Desktop/demo4/target/gluonfx/x86_64-linux/gvm/tmp/SVM-1662367049997/com.example.demo4.driver.o:(.data+0x1050): undefined reference to `Java_com_sun_security_auth_module_UnixSystem_getUnixInfo'
[Mon Sep 05 11:39:13 EEST 2022][INFO] [SUB] collect2: error: ld returned 1 exit status
[Mon Sep 05 11:39:13 EEST 2022][SEVERE] Process link failed with result: 1
Check the log files under /home/yousef66/Desktop/demo4/target/gluonfx/x86_64-linux/gvm/log
And please check https://docs.gluonhq.com/ for more information.
[Mon Sep 05 11:39:13 EEST 2022][INFO] Logging process [link] to file: /home/yousef66/Desktop/demo4/target/gluonfx/log/process-link-1662367153279.log
[Mon Sep 05 11:39:13 EEST 2022][SEVERE] Linking failed.
Check the log files under /home/yousef66/Desktop/demo4/target/gluonfx/x86_64-linux/gvm/log
And please check https://docs.gluonhq.com/ for more information.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:49 min
[INFO] Finished at: 2022-09-05T11:39:13+03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.gluonhq:gluonfx-maven-plugin:1.0.15:link (default-cli) on project demo4: Linking 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:50 min
[INFO] Finished at: 2022-09-05T11:39:13+03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.gluonhq:gluonfx-maven-plugin:1.0.15:build (default-cli) on project demo4: 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
Log file
[Mon Sep 05 12:46:34 EEST 2022][INFO] ==================== LINK TASK ====================
[Mon Sep 05 12:46:34 EEST 2022][FINE] Looking for resource: /native/linux/launcher.c
[Mon Sep 05 12:46:34 EEST 2022][FINE] PB Command for compile-additional-sources: gcc -c -DSUBSTRATE -I/home/yousef66/Desktop/graalvm-ce-java17-22.1.0/include -I/home/yousef66/Desktop/graalvm-ce-java17-22.1.0/include/linux -DGVM_17 -I/home/yousef66/Desktop/demo4/target/gluonfx/x86_64-linux/gvm/demo4 launcher.c
[Mon Sep 05 12:46:34 EEST 2022][FINE] Start process compile-additional-sources...
[Mon Sep 05 12:46:34 EEST 2022][FINE] Result for compile-additional-sources: 0
[Mon Sep 05 12:46:34 EEST 2022][FINE] PB Command for Get config for libavcodec: /usr/bin/pkg-config --libs libavcodec
[Mon Sep 05 12:46:34 EEST 2022][FINE] Start process Get config for libavcodec...
[Mon Sep 05 12:46:34 EEST 2022][FINE] [SUB] -lavcodec
[Mon Sep 05 12:46:34 EEST 2022][FINE] Result for Get config for libavcodec: 0
[Mon Sep 05 12:46:34 EEST 2022][FINE] Pkg libavcodec provided flags: [-lavcodec]
[Mon Sep 05 12:46:34 EEST 2022][FINE] PB Command for Get config for libavformat: /usr/bin/pkg-config --libs libavformat
[Mon Sep 05 12:46:34 EEST 2022][FINE] Start process Get config for libavformat...
[Mon Sep 05 12:46:34 EEST 2022][FINE] [SUB] -lavformat
[Mon Sep 05 12:46:34 EEST 2022][FINE] Result for Get config for libavformat: 0
[Mon Sep 05 12:46:34 EEST 2022][FINE] Pkg libavformat provided flags: [-lavformat]
[Mon Sep 05 12:46:34 EEST 2022][FINE] PB Command for Get config for libavutil: /usr/bin/pkg-config --libs libavutil
[Mon Sep 05 12:46:34 EEST 2022][FINE] Start process Get config for libavutil...
[Mon Sep 05 12:46:34 EEST 2022][FINE] [SUB] -lavutil
[Mon Sep 05 12:46:34 EEST 2022][FINE] Result for Get config for libavutil: 0
[Mon Sep 05 12:46:34 EEST 2022][FINE] Pkg libavutil provided flags: [-lavutil]
[Mon Sep 05 12:46:34 EEST 2022][FINE] PB Command for Get config for alsa: /usr/bin/pkg-config --libs alsa
[Mon Sep 05 12:46:34 EEST 2022][FINE] Start process Get config for alsa...
[Mon Sep 05 12:46:34 EEST 2022][FINE] [SUB] -lasound
[Mon Sep 05 12:46:34 EEST 2022][FINE] Result for Get config for alsa: 0
[Mon Sep 05 12:46:34 EEST 2022][FINE] Pkg alsa provided flags: [-lasound]
[Mon Sep 05 12:46:34 EEST 2022][FINE] All flags: [-lgstreamer-lite, -lavcodec, -lavformat, -lavutil, -lasound]
[Mon Sep 05 12:46:34 EEST 2022][FINE] PB Command for Get config for gl: /usr/bin/pkg-config --libs gl
[Mon Sep 05 12:46:34 EEST 2022][FINE] Start process Get config for gl...
[Mon Sep 05 12:46:34 EEST 2022][FINE] [SUB] -lGL
[Mon Sep 05 12:46:34 EEST 2022][FINE] Result for Get config for gl: 0
[Mon Sep 05 12:46:34 EEST 2022][FINE] Pkg gl provided flags: [-lGL]
[Mon Sep 05 12:46:34 EEST 2022][FINE] PB Command for Get config for x11: /usr/bin/pkg-config --libs x11
[Mon Sep 05 12:46:34 EEST 2022][FINE] Start process Get config for x11...
[Mon Sep 05 12:46:34 EEST 2022][FINE] [SUB] -lX11
[Mon Sep 05 12:46:34 EEST 2022][FINE] Result for Get config for x11: 0
[Mon Sep 05 12:46:34 EEST 2022][FINE] Pkg x11 provided flags: [-lX11]
[Mon Sep 05 12:46:34 EEST 2022][FINE] PB Command for Get config for gtk+-x11-3.0: /usr/bin/pkg-config --libs gtk+-x11-3.0
[Mon Sep 05 12:46:34 EEST 2022][FINE] Start process Get config for gtk+-x11-3.0...
[Mon Sep 05 12:46:34 EEST 2022][FINE] [SUB] -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0
[Mon Sep 05 12:46:34 EEST 2022][FINE] Result for Get config for gtk+-x11-3.0: 0
[Mon Sep 05 12:46:34 EEST 2022][FINE] Pkg gtk+-x11-3.0 provided flags: [-lgtk-3, -lgdk-3, -lpangocairo-1.0, -lpango-1.0, -lharfbuzz, -latk-1.0, -lcairo-gobject, -lcairo, -lgdk_pixbuf-2.0, -lgio-2.0, -lgobject-2.0, -lglib-2.0]
[Mon Sep 05 12:46:34 EEST 2022][FINE] PB Command for Get config for freetype2: /usr/bin/pkg-config --libs freetype2
[Mon Sep 05 12:46:34 EEST 2022][FINE] Start process Get config for freetype2...
[Mon Sep 05 12:46:34 EEST 2022][FINE] [SUB] -lfreetype
[Mon Sep 05 12:46:34 EEST 2022][FINE] Result for Get config for freetype2: 0
[Mon Sep 05 12:46:34 EEST 2022][FINE] Pkg freetype2 provided flags: [-lfreetype]
[Mon Sep 05 12:46:34 EEST 2022][FINE] PB Command for Get config for pangoft2: /usr/bin/pkg-config --libs pangoft2
[Mon Sep 05 12:46:34 EEST 2022][FINE] Start process Get config for pangoft2...
[Mon Sep 05 12:46:34 EEST 2022][FINE] [SUB] -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lharfbuzz -lfontconfig -lfreetype
[Mon Sep 05 12:46:34 EEST 2022][FINE] Result for Get config for pangoft2: 0
[Mon Sep 05 12:46:34 EEST 2022][FINE] Pkg pangoft2 provided flags: [-lpangoft2-1.0, -lpango-1.0, -lgobject-2.0, -lglib-2.0, -lharfbuzz, -lfontconfig, -lfreetype]
[Mon Sep 05 12:46:34 EEST 2022][FINE] PB Command for Get config for gthread-2.0: /usr/bin/pkg-config --libs gthread-2.0
[Mon Sep 05 12:46:34 EEST 2022][FINE] Start process Get config for gthread-2.0...
[Mon Sep 05 12:46:34 EEST 2022][FINE] [SUB] -lgthread-2.0 -pthread -lglib-2.0
[Mon Sep 05 12:46:34 EEST 2022][FINE] Result for Get config for gthread-2.0: 0
[Mon Sep 05 12:46:34 EEST 2022][FINE] Pkg gthread-2.0 provided flags: [-lgthread-2.0, -pthread, -lglib-2.0]
[Mon Sep 05 12:46:34 EEST 2022][FINE] PB Command for Get config for zlib: /usr/bin/pkg-config --libs zlib
[Mon Sep 05 12:46:34 EEST 2022][FINE] Start process Get config for zlib...
[Mon Sep 05 12:46:34 EEST 2022][FINE] [SUB] -lz
[Mon Sep 05 12:46:34 EEST 2022][FINE] Result for Get config for zlib: 0
[Mon Sep 05 12:46:34 EEST 2022][FINE] Pkg zlib provided flags: [-lz]
[Mon Sep 05 12:46:34 EEST 2022][FINE] PB Command for Get config for xtst: /usr/bin/pkg-config --libs xtst
[Mon Sep 05 12:46:34 EEST 2022][FINE] Start process Get config for xtst...
[Mon Sep 05 12:46:34 EEST 2022][FINE] [SUB] -lXtst
[Mon Sep 05 12:46:34 EEST 2022][FINE] Result for Get config for xtst: 0
[Mon Sep 05 12:46:34 EEST 2022][FINE] Pkg xtst provided flags: [-lXtst]
[Mon Sep 05 12:46:34 EEST 2022][FINE] PB Command for Get config for gmodule-no-export-2.0: /usr/bin/pkg-config --libs gmodule-no-export-2.0
[Mon Sep 05 12:46:34 EEST 2022][FINE] Start process Get config for gmodule-no-export-2.0...
[Mon Sep 05 12:46:34 EEST 2022][FINE] [SUB] -lgmodule-2.0 -pthread -lglib-2.0
[Mon Sep 05 12:46:34 EEST 2022][FINE] Result for Get config for gmodule-no-export-2.0: 0
[Mon Sep 05 12:46:34 EEST 2022][FINE] Pkg gmodule-no-export-2.0 provided flags: [-lgmodule-2.0, -pthread, -lglib-2.0]
[Mon Sep 05 12:46:34 EEST 2022][FINE] All flags: [-Wl,--no-whole-archive, -lGL, -lX11, -lgtk-3, -lgdk-3, -lpangocairo-1.0, -lpango-1.0, -lharfbuzz, -latk-1.0, -lcairo-gobject, -lcairo, -lgdk_pixbuf-2.0, -lgio-2.0, -lgobject-2.0, -lglib-2.0, -lfreetype, -lpangoft2-1.0, -lpango-1.0, -lgobject-2.0, -lglib-2.0, -lharfbuzz, -lfontconfig, -lfreetype, -lgthread-2.0, -pthread, -lglib-2.0, -lstdc++, -lz, -lXtst, -lm, -lgmodule-2.0, -pthread, -lglib-2.0]
[Mon Sep 05 12:46:34 EEST 2022][FINE] PB Command for link: gcc /home/yousef66/Desktop/demo4/target/gluonfx/x86_64-linux/gvm/demo4/launcher.o /home/yousef66/Desktop/demo4/target/gluonfx/x86_64-linux/gvm/tmp/SVM-1662371091887/com.example.demo4.driver.o /home/yousef66/Desktop/graalvm-ce-java17-22.1.0/lib/static/linux-amd64/glibc/libjava.a /home/yousef66/Desktop/graalvm-ce-java17-22.1.0/lib/static/linux-amd64/glibc/libnio.a /home/yousef66/Desktop/graalvm-ce-java17-22.1.0/lib/static/linux-amd64/glibc/libzip.a /home/yousef66/Desktop/graalvm-ce-java17-22.1.0/lib/static/linux-amd64/glibc/libnet.a /home/yousef66/Desktop/graalvm-ce-java17-22.1.0/lib/static/linux-amd64/glibc/libprefs.a /home/yousef66/Desktop/graalvm-ce-java17-22.1.0/lib/static/linux-amd64/glibc/libj2pkcs11.a /home/yousef66/Desktop/graalvm-ce-java17-22.1.0/lib/static/linux-amd64/glibc/libextnet.a /home/yousef66/Desktop/graalvm-ce-java17-22.1.0/lib/static/linux-amd64/glibc/libfdlibm.a /home/yousef66/Desktop/graalvm-ce-java17-22.1.0/lib/static/linux-amd64/glibc/libfontmanager.a /home/yousef66/Desktop/graalvm-ce-java17-22.1.0/lib/static/linux-amd64/glibc/libjavajpeg.a /home/yousef66/Desktop/graalvm-ce-java17-22.1.0/lib/static/linux-amd64/glibc/liblcms.a /home/yousef66/Desktop/graalvm-ce-java17-22.1.0/lib/static/linux-amd64/glibc/libawt_headless.a /home/yousef66/Desktop/graalvm-ce-java17-22.1.0/lib/static/linux-amd64/glibc/libawt.a -l:libjvm.a -l:liblibchelper.a -lz -ldl -lstdc++ -lpthread -Wl,--wrap=pow -rdynamic -lprism_es2 -lglass -lglassgtk3 -ljavafx_font -ljavafx_font_freetype -ljavafx_font_pango -ljavafx_iio -lgstreamer-lite -lavcodec -lavformat -lavutil -lasound -Wl,--no-whole-archive -lGL -lX11 -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lfreetype -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lharfbuzz -lfontconfig -lfreetype -lgthread-2.0 -pthread -lglib-2.0 -lstdc++ -lz -lXtst -lm -lgmodule-2.0 -pthread -lglib-2.0 -lm -ldl -o /home/yousef66/Desktop/demo4/target/gluonfx/x86_64-linux/demo4 -L/home/yousef66/Desktop/graalvm-ce-java17-22.1.0/lib/svm/clibraries/linux-amd64 -L/home/yousef66/.gluon/substrate/javafxStaticSdk/19-ea+8/linux-x86_64/sdk/lib -ljaas
[Mon Sep 05 12:46:34 EEST 2022][FINE] Start process link...
[Mon Sep 05 12:46:34 EEST 2022][INFO] [SUB] /usr/bin/ld: cannot find -ljaas
[Mon Sep 05 12:46:34 EEST 2022][INFO] [SUB] collect2: error: ld returned 1 exit status
[Mon Sep 05 12:46:34 EEST 2022][FINE] Result for link: 1
[Mon Sep 05 12:46:34 EEST 2022][SEVERE] Process link failed with result: 1
Check the log files under /home/yousef66/Desktop/demo4/target/gluonfx/x86_64-linux/gvm/log
And please check https://docs.gluonhq.com/ for more information.
[Mon Sep 05 12:46:34 EEST 2022][INFO] Logging process [link] to file: /home/yousef66/Desktop/demo4/target/gluonfx/log/process-link-1662371194695.log
[Mon Sep 05 12:46:34 EEST 2022][SEVERE] Linking failed.
Check the log files under /home/yousef66/Desktop/demo4/target/gluonfx/x86_64-linux/gvm/log
And please check https://docs.gluonhq.com/ for more information.
I'm trying to build a native image using:
GraalVM: 22.2.0
GluonFx maven Plugin: 1.0.14
And I get the following error:
[Thu Jul 28 13:31:42 CEST 2022][INFO] [SUB] [1/7] Initializing... (0.0s # 0.42GB)
[Thu Jul 28 13:31:42 CEST 2022][INFO] [SUB] Fatal error: java.lang.IllegalAccessError: class com.oracle.svm.core.genscavenge.graal.HeapFeature (in unnamed module #0x499d741f) cannot access class com.oracle.svm.core.SubstrateOptions (in module org.graalvm.nativeimage.builder) because module org.graalvm.nativeimage.builder does not export com.oracle.svm.core to unnamed module #0x499d741f
[Thu Jul 28 13:31:42 CEST 2022][INFO] [SUB] at com.oracle.svm.core.genscavenge.graal.HeapFeature.isInConfiguration(HeapFeature.java:65)
[Thu Jul 28 13:31:42 CEST 2022][INFO] [SUB] at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.FeatureHandler.registerFeature(FeatureHandler.java:183)
[Thu Jul 28 13:31:42 CEST 2022][INFO] [SUB] at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.FeatureHandler.registerFeatures(FeatureHandler.java:128)
[Thu Jul 28 13:31:42 CEST 2022][INFO] [SUB] at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.setupNativeImage(NativeImageGenerator.java:838)
[Thu Jul 28 13:31:42 CEST 2022][INFO] [SUB] at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:561)
[Thu Jul 28 13:31:42 CEST 2022][INFO] [SUB] at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:521)
[Thu Jul 28 13:31:42 CEST 2022][INFO] [SUB] at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:407)
[Thu Jul 28 13:31:42 CEST 2022][INFO] [SUB] at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:585)
[Thu Jul 28 13:31:42 CEST 2022][INFO] [SUB] at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:128)
[Thu Jul 28 13:31:42 CEST 2022][INFO] [SUB] ------------------------------------------------------------------------------------------------------------------------
[Thu Jul 28 13:31:42 CEST 2022][INFO] [SUB] 1.7s (8.7% of total time) in 17 GCs | Peak RSS: 1.48GB | CPU load: 2.23
[Thu Jul 28 13:31:42 CEST 2022][INFO] [SUB] ========================================================================================================================
Thanks in advance for any help you can provide me
Updated:
By the suggestion of #peterz I've downgraded the version of GraalVM, now running with 22.1.0, and the error is different:
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB]
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB] [1/7] Initializing... (0.0s # 0.56GB)
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB] Error: ImageSingletons.add must not overwrite existing key com.oracle.svm.core.jdk.ProtectionDomainSupport
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB] Existing value: com.oracle.svm.core.jdk.ProtectionDomainSupport#1ff463bb
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB] New value: com.oracle.svm.core.jdk.ProtectionDomainSupport#3b9c9b8b
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB] com.oracle.svm.core.util.UserError$UserException: ImageSingletons.add must not overwrite existing key com.oracle.svm.core.jdk.ProtectionDomainSupport
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB] Existing value: com.oracle.svm.core.jdk.ProtectionDomainSupport#1ff463bb
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB] New value: com.oracle.svm.core.jdk.ProtectionDomainSupport#3b9c9b8b
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB] at com.oracle.svm.core.util.UserError.abort(UserError.java:72)
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB] at com.oracle.svm.hosted.ImageSingletonsSupportImpl$HostedManagement.doAdd(ImageSingletonsSupportImpl.java:109)
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB] at com.oracle.svm.hosted.ImageSingletonsSupportImpl.add(ImageSingletonsSupportImpl.java:39)
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB] at org.graalvm.sdk/org.graalvm.nativeimage.ImageSingletons.add(ImageSingletons.java:73)
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB] at com.oracle.svm.hosted.ProtectionDomainFeature.afterRegistration(ProtectionDomainFeature.java:48)
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB] at com.oracle.svm.hosted.NativeImageGenerator.lambda$setupNativeImage$14(NativeImageGenerator.java:832)
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB] at com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:74)
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB] at com.oracle.svm.hosted.NativeImageGenerator.setupNativeImage(NativeImageGenerator.java:832)
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB] at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:555)
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB] at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:515)
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB] at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:407)
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB] at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:585)
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB] at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:128)
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB] at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:615)
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB] ------------------------------------------------------------------------------------------------------------------------
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB] 1.7s (9.6% of total time) in 16 GCs | Peak RSS: 1.39GB | CPU load: 3.91
[Thu Jul 28 14:32:34 CEST 2022][INFO] [SUB] ========================================================================================================================
I'm currently trying to use Gluon's client-maven-plugin to build a native JavaFX app on Windows.
When I run mvn clean client:build, the build finishes successfully and produces a ~75MB exe file. However, when I try to run the app using mvn client:run, nothing happens and the terminal immediately tells me that my build was successful. I am not sure what's going on.
For reference, this is my pom.xml file:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>stl</groupId>
<artifactId>threebodysimulation</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>threebodysimulation</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.release>11</maven.compiler.release>
<javafx.version>14.0.1</javafx.version>
<mainClassName>stl.threebodysimulation.Launcher</mainClassName>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>${javafx.version}</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>${javafx.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
<version>3.2</version>
</dependency>
</dependencies>
<pluginRepositories>
<pluginRepository>
<id>oss-sonatype-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<release>${maven.compiler.release}</release>
</configuration>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.4</version>
<configuration>
<mainClass>stl.threebodysimulation.Launcher</mainClass>
<launcher>launcher</launcher>
</configuration>
</plugin>
<plugin>
<groupId>com.gluonhq</groupId>
<artifactId>client-maven-plugin</artifactId>
<version>0.1.27-SNAPSHOT</version>
<configuration>
<reflectionList>
<list>javafx.application.Platform</list>
<list>javafx.concurrent.Task</list>
<list>javafx.fxml.FXML</list>
<list>javafx.fxml.FXMLLoader</list>
<list>javafx.fxml.Initializable</list>
<list>javafx.geometry.Insets</list>
<list>javafx.scene.Parent</list>
<list>javafx.scene.Scene</list>
<list>javafx.scene.image.Image</list>
<list>javafx.stage.Stage</list>
<list>javafx.stage.Modality</list>
<list>javafx.stage.Window</list>
<list>javafx.scene.image.Image</list>
<list>javafx.scene.image.ImageView</list>
<list>javafx.scene.layout.BorderPane</list>
<list>javafx.scene.layout.HBox</list>
<list>javafx.scene.layout.StackPane</list>
<list>javafx.scene.layout.VBox</list>
<list>javafx.scene.layout.ColumnConstraints</list>
<list>javafx.scene.layout.GridPane</list>
<list>javafx.scene.layout.RowConstraints</list>
<list>javafx.scene.layout.AnchorPane</list>
<list>javafx.scene.canvas.Canvas</list>
<list>javafx.scene.canvas.GraphicsContext</list>
<list>javafx.scene.control.Tab</list>
<list>javafx.scene.control.TabPane</list>
<list>javafx.scene.control.Button</list>
<list>javafx.scene.control.Label</list>
<list>javafx.scene.control.CheckBox</list>
<list>javafx.scene.control.ChoiceBox</list>
<list>javafx.scene.control.ColorPicker</list>
<list>javafx.scene.control.TextField</list>
<list>javafx.scene.control.TextFormatter</list>
<list>javafx.scene.control.Tooltip</list>
<list>javafx.scene.control.Separator</list>
<list>javafx.scene.text.Font</list>
<list>javafx.scene.paint.Color</list>
<list>javafx.scene.shape.Circle</list>
<list>javafx.application.Application</list>
<list>javafx.util.Duration</list>
<list>org.apache.commons.math3.exception.NumberIsTooLargeException</list>
<list>org.apache.commons.math3.exception.NumberIsTooSmallException</list>
<list>org.apache.commons.math3.ode.nonstiff.DormandPrince853Integrator</list>
<list>org.apache.commons.math3.ode.FirstOrderDifferentialEquations</list>
<list>java.util.Arrays</list>
<list>java.util.HashMap</list>
<list>java.text.DecimalFormat</list>
<list>java.net.URL</list>
<list>java.util.ResourceBundle</list>
<list>stl.threebodysimulation.CanvasPanelFXMLController</list>
<list>stl.threebodysimulation.CanvasWrapper</list>
<list>stl.threebodysimulation.ErrorMessage</list>
<list>stl.threebodysimulation.InfoFXMLController</list>
<list>stl.threebodysimulation.InfoPanelFXMLController</list>
<list>stl.threebodysimulation.Launcher</list>
<list>stl.threebodysimulation.Listener</list>
<list>stl.threebodysimulation.MainApp</list>
<list>stl.threebodysimulation.NumberFormat</list>
<list>stl.threebodysimulation.ParameterFXMLController</list>
<list>stl.threebodysimulation.Particle</list>
<list>stl.threebodysimulation.ParticleDiffEq</list>
<list>stl.threebodysimulation.PopupWindowFXMLController</list>
<list>stl.threebodysimulation.SceneFXMLController</list>
<list>stl.threebodysimulation.SettingsPanelFXMLController</list>
<list>stl.threebodysimulation.SimulationSettings</list>
<list>stl.threebodysimulation.SimulationState</list>
<list>stl.threebodysimulation.TextFieldWrapper</list>
</reflectionList>
<mainClass>stl.threebodysimulation.Launcher</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</project>
I originally thought it might be a problem with the reflection list, so I added every class I had (and also every import I used in both java and FXML) to the list. It doesn't seem to help. The program runs normally when I use mvn compiler:compile resources:resources javafx:run.
Does anyone have any idea on where the problem might be? Thanks!
EDIT:
The Maven file references a "Launcher" class which looks like this:
package stl.threebodysimulation;
import javafx.application.Application;
/**
* The class whose main method is called when the application is run.
*/
public class Launcher {
/**
* Runs the application.
* #param args Terminal arguments.
*/
public static void main(String[] args) {
Application.launch(MainApp.class, args);
}
}
This calls a MainApp class that looks like this:
package stl.threebodysimulation;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Stage;
/**
* This class launches the UI of the app.
*/
public class MainApp extends Application {
/**
* #param stage The window that the app will be run in. Supplied by the Application parent class.
* #throws Exception An exception that occurs if the layout files are not found. Should never occur.
*/
#Override
public void start(Stage stage) throws Exception {
// Set up the scene.fxml files and the CSS files. The inputs and outputs exist to implement the parent class Application.
FXMLLoader appLoader = new FXMLLoader(getClass().getResource("/scene.fxml"));
Parent root = appLoader.load();
Scene scene = new Scene(root, 1200, 900);
// Load in CSS
scene.getStylesheets().add(getClass().getResource("/bootstrap3.css").toExternalForm());
// We don't want the window to be resizable, to save us the UI headache.
stage.setResizable(false);
// Icon of app
stage.getIcons().add(new Image("/appIcon.png"));
// Title of app
stage.setTitle("Three-Body Simulation");
// Stage the UI.
stage.setScene(scene);
stage.show();
}
}
EDIT 2:
The logs for the error can be seen here:
[Wed Jun 03 18:58:32 EDT 2020][FINE] [SUB] Exception in Application start method
[Wed Jun 03 18:58:32 EDT 2020][FINE] [SUB] Exception in thread "main" java.lang.RuntimeException: Exception in Application start method
[Wed Jun 03 18:58:32 EDT 2020][FINE] [SUB] at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:900)
[Wed Jun 03 18:58:32 EDT 2020][FINE] [SUB] at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
[Wed Jun 03 18:58:32 EDT 2020][FINE] [SUB] at java.lang.Thread.run(Thread.java:834)
[Wed Jun 03 18:58:32 EDT 2020][FINE] [SUB] at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:517)
[Wed Jun 03 18:58:32 EDT 2020][FINE] [SUB] at com.oracle.svm.core.windows.WindowsJavaThreads.osThreadStartRoutine(WindowsJavaThreads.java:138)
[Wed Jun 03 18:58:32 EDT 2020][FINE] [SUB] Caused by: javafx.fxml.LoadException:
[Wed Jun 03 18:58:32 EDT 2020][FINE] [SUB] stl/threebodysimulation/settingsPanel.fxml:14
[Wed Jun 03 18:58:32 EDT 2020][FINE] [SUB] stl/threebodysimulation/scene.fxml:14
[Wed Jun 03 18:58:32 EDT 2020][FINE] [SUB]
[Wed Jun 03 18:58:32 EDT 2020][FINE] [SUB] at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2629)
[Wed Jun 03 18:58:32 EDT 2020][FINE] [SUB] at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2607)
[Wed Jun 03 18:58:32 EDT 2020][FINE] [SUB] at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2470)
[Wed Jun 03 18:58:32 EDT 2020][FINE] [SUB] at javafx.fxml.FXMLLoader$IncludeElement.constructValue(FXMLLoader.java:1154)
[Wed Jun 03 18:58:32 EDT 2020][FINE] [SUB] at javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:754)
[Wed Jun 03 18:58:32 EDT 2020][FINE] [SUB] at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2726)
[Wed Jun 03 18:58:32 EDT 2020][FINE] [SUB] at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2556)
[Wed Jun 03 18:58:32 EDT 2020][FINE] [SUB] at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2470)
[Wed Jun 03 18:58:32 EDT 2020][FINE] [SUB] at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2439)
[Wed Jun 03 18:58:32 EDT 2020][FINE] [SUB] at stl.threebodysimulation.MainApp.start(MainApp.java:23)
[Wed Jun 03 18:58:32 EDT 2020][FINE] [SUB] at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
[Wed Jun 03 18:58:32 EDT 2020][FINE] [SUB] at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
[Wed Jun 03 18:58:32 EDT 2020][FINE] [SUB] at com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
[Wed Jun 03 18:58:32 EDT 2020][FINE] [SUB] at java.security.AccessController.doPrivileged(AccessController.java:101)
[Wed Jun 03 18:58:32 EDT 2020][FINE] [SUB] at com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
[Wed Jun 03 18:58:32 EDT 2020][FINE] [SUB] at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
[Wed Jun 03 18:58:32 EDT 2020][FINE] [SUB] at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_VA_LIST:Ljava_lang_Runnable_2_0002erun_00028_00029V(JNIJavaCallWrappers.java:0)
[Wed Jun 03 18:58:32 EDT 2020][FINE] [SUB] at com.sun.glass.ui.win.WinApplication._runLoop(WinApplication.java)
[Wed Jun 03 18:58:32 EDT 2020][FINE] [SUB] at com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
[Wed Jun 03 18:58:32 EDT 2020][FINE] [SUB] ... 3 more
[Wed Jun 03 18:58:32 EDT 2020][FINE] [SUB] Caused by: java.io.IOException: Including "resource:stl/threebodysimulation/settingsPanel.fxml" in "resource:stl/threebodysimulation/settingsPanel.fxml" created cyclic reference.
[Wed Jun 03 18:58:32 EDT 2020][FINE] [SUB] at javafx.fxml.FXMLLoader$IncludeElement.constructValue(FXMLLoader.java:1146)
[Wed Jun 03 18:58:32 EDT 2020][FINE] [SUB] at javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:754)
[Wed Jun 03 18:58:32 EDT 2020][FINE] [SUB] at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2726)
[Wed Jun 03 18:58:32 EDT 2020][FINE] [SUB] at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2556)
[Wed Jun 03 18:58:32 EDT 2020][FINE] [SUB] ... 20 more
[Wed Jun 03 18:58:32 EDT 2020][FINE] Result for run until end: 0
A similar error can be found here.
Line 14 of scene.fxml looks like this:
<fx:include fx:id="settingsPanel" source="settingsPanel.fxml" />
My group publishes executable jars (not applets, just to be clear) for nearly all of our functionality. One of our new executables is a Web service client that relies on Jersey. I'm trying to use the automatic POJO mapping facility to unmarshal responses (i.e., I have JSONConfiguration.FEATURE_POJO_MAPPING set to true in the ClientConfig) but when I execute the jar I get the "I don't know how to unmarshal this response" message:
SEVERE: A message body reader for Java class edu.mit.broad.picard.bass.GetSite, and Java type class edu.mit.broad.picard.bass.GetSite, and MIME media type application/json was not found
The app works just fine if I run it from my IDE (IntelliJ). I'm assuming it's a problem with the way in which the jar file is packaged but I don't know the details of Jersey (or Jackson, for that matter) well enough to get this fixed. Any hints?
This is Java 1.7, Jersey bundle 1.17.1 and Jackson 1.9.13. All the com/sun/**/* and org/codehaus/**/* files are being included in the jar.
Thanks for your help!!
Edit:
I checked the META-INF dir for the needed .../services dir. Here's what's in it:
cm59f-0fa:zamboni jrose$ jar tvf GenerateGetSite.jar | grep META-INF | grep services
0 Thu Aug 15 10:43:32 EDT 2013 META-INF/services/
0 Thu Feb 28 15:29:04 EST 2013 META-INF/services/com.sun.jersey.server.impl.model.method.dispatch.ResourceMethodDispatchProvider
514 Thu Feb 28 15:29:04 EST 2013 META-INF/services/com.sun.jersey.spi.HeaderDelegateProvider
563 Thu Feb 28 15:29:04 EST 2013 META-INF/services/com.sun.jersey.spi.StringReaderProvider
147 Thu Feb 28 15:29:04 EST 2013 META-INF/services/com.sun.jersey.spi.container.ContainerProvider
60 Thu Feb 28 15:29:04 EST 2013 META-INF/services/com.sun.jersey.spi.container.ContainerRequestFilter
0 Thu Feb 28 15:29:04 EST 2013 META-INF/services/com.sun.jersey.spi.container.ContainerResponseFilter
377 Wed Feb 27 20:17:28 EST 2013 META-INF/services/com.sun.jersey.spi.container.ResourceMethodCustomInvokerDispatchProvider
376 Wed Feb 27 20:17:28 EST 2013 META-INF/services/com.sun.jersey.spi.container.ResourceMethodDispatchProvider
64 Thu Feb 28 15:29:04 EST 2013 META-INF/services/com.sun.jersey.spi.container.WebApplicationProvider
267 Thu Feb 28 15:29:04 EST 2013 META-INF/services/com.sun.jersey.spi.inject.InjectableProvider
44 Wed Feb 27 20:17:06 EST 2013 META-INF/services/javax.enterprise.inject.spi.Extension
882 Mon Dec 19 14:53:22 EST 2011 META-INF/services/javax.script.ScriptEngineFactory
79 Wed Feb 27 20:17:06 EST 2013 META-INF/services/javax.servlet.ServletContainerInitializer
2880 Thu Feb 28 15:29:04 EST 2013 META-INF/services/javax.ws.rs.ext.MessageBodyReader
2654 Thu Feb 28 15:29:04 EST 2013 META-INF/services/javax.ws.rs.ext.MessageBodyWriter
56 Thu Feb 28 15:29:04 EST 2013 META-INF/services/javax.ws.rs.ext.RuntimeDelegate`
My guess would be that you are creating one jar that contains the contents of all of your jar dependencies. If this is the case, the issue is probably due to improper construction of your one jar. Jersey relies on resources in META-INF/services for its proper operation. You need to make sure that the contents of META-INF/services get merged into your one jar.
One option that is working for me is the maven-shade-plugin, which includes a transformer that does exactly this merging:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
</transformers>
</configuration>
</plugin>