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" />
Related
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 am facing a problem at Run time. it's a JavaFX application.
facing this issue for 3 days now. I tried to figure it out myself. but I didn't found a solution. so that's why I'm posting the question.
The Problem is I run to try to get firestore object it's giving me the below exception.
it's works fine on javafx:run it's only giving on client:run after deploy.
here is the code.
try {
FirebaseOptions options = new FirebaseOptions.Builder()
.setCredentials(GoogleCredentials.fromStream(Singleton.getInstance().getAbsolutePath("service/credentials.json")))
.build();
FirebaseApp.initializeApp(options);
this.firestore = FirestoreClient.getFirestore();
} catch (IOException e) {
System.out.println("Failed to connect the firebase.");
e.printStackTrace();
}
and here is the error I'm facing.
Exception in Application start method
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] Exception in thread "main" java.lang.RuntimeException: Exception in Application start method
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:900)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at java.lang.Thread.run(Thread.java:834)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:519)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.oracle.svm.core.windows.WindowsJavaThreads.osThreadStartRoutine(WindowsJavaThreads.java:138)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] Caused by: com.oracle.svm.core.jdk.UnsupportedFeatureError: Unsupported method of Unsafe
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.oracle.svm.core.util.VMError.unsupportedFeature(VMError.java:87)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at jdk.internal.misc.Unsafe.staticFieldOffset(Unsafe.java:231)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at sun.misc.Unsafe.staticFieldOffset(Unsafe.java:662)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent0$5.run(PlatformDependent0.java:282)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at java.security.AccessController.doPrivileged(AccessController.java:84)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent0.<clinit>(PlatformDependent0.java:267)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.oracle.svm.core.classinitialization.ClassInitializationInfo.invokeClassInitializer(ClassInitializationInfo.java:375)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:295)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent.isAndroid(PlatformDependent.java:289)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent.<clinit>(PlatformDependent.java:92)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.oracle.svm.core.classinitialization.ClassInitializationInfo.invokeClassInitializer(ClassInitializationInfo.java:375)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:295)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at io.grpc.netty.shaded.io.netty.util.AsciiString.<init>(AsciiString.java:223)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at io.grpc.netty.shaded.io.netty.util.AsciiString.<init>(AsciiString.java:210)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at io.grpc.netty.shaded.io.netty.util.AsciiString.cached(AsciiString.java:1401)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at io.grpc.netty.shaded.io.netty.util.AsciiString.<clinit>(AsciiString.java:48)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.oracle.svm.core.classinitialization.ClassInitializationInfo.invokeClassInitializer(ClassInitializationInfo.java:375)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:295)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at io.grpc.netty.shaded.io.grpc.netty.Utils.<clinit>(Utils.java:72)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.oracle.svm.core.classinitialization.ClassInitializationInfo.invokeClassInitializer(ClassInitializationInfo.java:375)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:295)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder.<clinit>(NettyChannelBuilder.java:74)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.oracle.svm.core.classinitialization.ClassInitializationInfo.invokeClassInitializer(ClassInitializationInfo.java:375)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:295)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at io.grpc.netty.shaded.io.grpc.netty.NettyChannelProvider.builderForAddress(NettyChannelProvider.java:37)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at io.grpc.netty.shaded.io.grpc.netty.NettyChannelProvider.builderForAddress(NettyChannelProvider.java:23)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at io.grpc.ManagedChannelBuilder.forAddress(ManagedChannelBuilder.java:39)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.createSingleChannel(InstantiatingGrpcChannelProvider.java:280)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.access$1600(InstantiatingGrpcChannelProvider.java:71)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider$1.createSingleChannel(InstantiatingGrpcChannelProvider.java:210)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.google.api.gax.grpc.ChannelPool.create(ChannelPool.java:72)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.createChannel(InstantiatingGrpcChannelProvider.java:217)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.google.api.gax.grpc.InstantiatingGrpcChannelProvider.getTransportChannel(InstantiatingGrpcChannelProvider.java:200)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.google.api.gax.rpc.ClientContext.create(ClientContext.java:156)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.google.api.gax.rpc.ClientContext.create(ClientContext.java:123)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.google.cloud.firestore.spi.v1.GrpcFirestoreRpc.<init>(GrpcFirestoreRpc.java:122)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.google.cloud.firestore.FirestoreOptions$DefaultFirestoreRpcFactory.create(FirestoreOptions.java:90)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.google.cloud.firestore.FirestoreOptions$DefaultFirestoreRpcFactory.create(FirestoreOptions.java:82)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.google.cloud.ServiceOptions.getRpc(ServiceOptions.java:561)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.google.cloud.firestore.FirestoreOptions.getFirestoreRpc(FirestoreOptions.java:385)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.google.cloud.firestore.FirestoreImpl.<init>(FirestoreImpl.java:67)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.google.cloud.firestore.FirestoreOptions$DefaultFirestoreFactory.create(FirestoreOptions.java:73)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.google.cloud.firestore.FirestoreOptions$DefaultFirestoreFactory.create(FirestoreOptions.java:66)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.google.cloud.ServiceOptions.getService(ServiceOptions.java:541)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.google.firebase.cloud.FirestoreClient.<init>(FirestoreClient.java:45)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.google.firebase.cloud.FirestoreClient.<init>(FirestoreClient.java:29)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.google.firebase.cloud.FirestoreClient$FirestoreClientService.<init>(FirestoreClient.java:95)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.google.firebase.cloud.FirestoreClient.getInstance(FirestoreClient.java:85)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.google.firebase.cloud.FirestoreClient.getFirestore(FirestoreClient.java:78)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.google.firebase.cloud.FirestoreClient.getFirestore(FirestoreClient.java:64)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at org.quiz.service.DataManager.authorize(DataManager.java:24)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at org.quiz.App.start(App.java:24)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at java.security.AccessController.doPrivileged(AccessController.java:102)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_VA_LIST:Ljava_lang_Runnable_2_0002erun_00028_00029V(JNIJavaCallWrappers.java:0)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.sun.glass.ui.win.WinApplication._runLoop(WinApplication.java)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] at com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
[Wed Apr 07 13:10:02 PKT 2021][INFO] [SUB] ... 3 more
when FirestoreClient.getFirestore(); a method called it is giving me runtime error saying t's unsafe.
how do I avoid it?
This is the HelloFX project from gluon client samples project.
I've added a model named 'Person'.
package hellofx;
import java.time.LocalDate;
public class Person {
private Integer id;
private String name;
private LocalDate dob;
// Getters and Setters
}
And added the following dependencies in 'pom.xml':
jackson-databind
jackson-datatype-jsr310
And added serialization and deserialization methods in main class.
public class HelloFX extends Application {
private Label parseStatusLabel = new Label("");
private String serializedString = null;
public void start(Stage stage) {
String javaVersion = System.getProperty("java.version");
String javafxVersion = System.getProperty("javafx.version");
Label label = new Label("Hello, JavaFX " + javafxVersion + ", running on Java " + javaVersion + ".");
ImageView imageView = new ImageView(new Image(HelloFX.class.getResourceAsStream("/hellofx/openduke.png")));
imageView.setFitHeight(200);
imageView.setPreserveRatio(true);
Button serButton = new Button("Serialize");
serButton.setOnAction(e -> serialize());
Button deserButton = new Button("Deserialize");
deserButton.setOnAction(e -> deserialize());
VBox root = new VBox(30, imageView, label, serButton, deserButton, parseStatusLabel);
root.setAlignment(Pos.CENTER);
Scene scene = new Scene(root, 640, 480);
scene.getStylesheets().add(HelloFX.class.getResource("styles.css").toExternalForm());
stage.setScene(scene);
stage.show();
}
private void serialize() {
Person person = new Person();
person.setId(1);
person.setName("John Doe");
person.setDob(LocalDate.of(1960, 10, 10));
ObjectMapper mapper = new ObjectMapper();
mapper.registerModule(new JavaTimeModule());
try {
serializedString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(person);
parseStatusLabel.setText("Serialization success \n" + serializedString);
} catch (JsonProcessingException e) {
parseStatusLabel.setText("Serialization failed");
e.printStackTrace();
}
}
private void deserialize() {
try {
ObjectMapper mapper = new ObjectMapper();
mapper.registerModule(new JavaTimeModule());
Person person = mapper.readValue(serializedString, Person.class);
parseStatusLabel.setText("Deserialization successful > " + person);
} catch (JsonMappingException e) {
parseStatusLabel.setText("Deserialization failed");
e.printStackTrace();
} catch (JsonProcessingException e) {
parseStatusLabel.setText("Deserialization failed");
e.printStackTrace();
}
}
public static void main(String[] args) {
launch(args);
}
}
I ran it in desktop and it ran fine. Both serialization and deserialization worked.
And then I tried to build APK with mvn client:build -P android , it throws the following error event after running mvn client:runagent.
[Thu Mar 25 10:38:59 IST 2021][INFO] We will now compile your code for aarch64-linux-android. This may take some time.
[Thu Mar 25 10:39:14 IST 2021][INFO] [SUB] [hellofx.hellofx:215] classlist: 5,873.73 ms, 0.96 GB
[Thu Mar 25 10:39:16 IST 2021][INFO] [SUB] [hellofx.hellofx:215] (cap): 288.58 ms, 0.96 GB
[Thu Mar 25 10:39:17 IST 2021][INFO] [SUB] [hellofx.hellofx:215] setup: 2,968.21 ms, 0.96 GB
[Thu Mar 25 10:40:25 IST 2021][INFO] [SUB] [hellofx.hellofx:215] (clinit): 1,142.49 ms, 3.74 GB
[Thu Mar 25 10:40:25 IST 2021][INFO] [SUB] [hellofx.hellofx:215] (typeflow): 30,888.81 ms, 3.74 GB
[Thu Mar 25 10:40:25 IST 2021][INFO] [SUB] [hellofx.hellofx:215] (objects): 28,773.30 ms, 3.74 GB
[Thu Mar 25 10:40:25 IST 2021][INFO] [SUB] [hellofx.hellofx:215] (features): 5,209.44 ms, 3.74 GB
[Thu Mar 25 10:40:26 IST 2021][INFO] [SUB] [hellofx.hellofx:215] analysis: 68,730.14 ms, 3.74 GB
[Thu Mar 25 10:40:26 IST 2021][INFO] [SUB] Warning: Aborting stand-alone image build. Unsupported features in 11 methods[Thu Mar 25 10:40:26 IST 2021][INFO] [SUB] Detailed message:
[Thu Mar 25 10:40:26 IST 2021][INFO] [SUB] Error: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved method during parsing: com.fasterxml.jackson.databind.DeserializationContext.extractScalarFromObject(com.fasterxml.jackson.core.JsonParser, com.fasterxml.jackson.databind.JsonDeserializer, java.lang.Class). To diagnose the issue you can use the --allow-incomplete-classpath option. The missing method is then reported at run time when it is accessed the first time.
[Thu Mar 25 10:40:26 IST 2021][INFO] [SUB] Trace:
[Thu Mar 25 10:40:26 IST 2021][INFO] [SUB] at parsing com.fasterxml.jackson.datatype.jsr310.deser.DurationDeserializer.deserialize(DurationDeserializer.java:137)
[Thu Mar 25 10:40:26 IST 2021][INFO] [SUB] Call path from entry point to com.fasterxml.jackson.datatype.jsr310.deser.DurationDeserializer.deserialize(JsonParser, DeserializationContext):
[Thu Mar 25 10:40:26 IST 2021][INFO] [SUB] at com.fasterxml.jackson.datatype.jsr310.deser.DurationDeserializer.deserialize(DurationDeserializer.java:125)
[Thu Mar 25 10:40:26 IST 2021][INFO] [SUB] at com.fasterxml.jackson.datatype.jsr310.deser.DurationDeserializer.deserialize(DurationDeserializer.java:43)
[Thu Mar 25 10:40:26 IST 2021][INFO] [SUB] at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4482)
[Thu Mar 25 10:40:26 IST 2021][INFO] [SUB] at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3434)
[Thu Mar 25 10:40:26 IST 2021][INFO] [SUB] at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3402)
[Thu Mar 25 10:40:26 IST 2021][INFO] [SUB] at hellofx.HelloFX.deserialize(HelloFX.java:99)
[Thu Mar 25 10:40:26 IST 2021][INFO] [SUB] at com.oracle.svm.reflect.HelloFX_deserialize_15f8adc753d5dce15c2070972d1be99d7c98ca42_239.invoke(Unknown Source)
[Thu Mar 25 10:40:26 IST 2021][INFO] [SUB] at java.lang.reflect.Method.invoke(Method.java:566)
[Thu Mar 25 10:40:26 IST 2021][INFO] [SUB] at com.sun.prism.GraphicsPipeline.createPipeline(GraphicsPipeline.java:224)
[Thu Mar 25 10:40:26 IST 2021][INFO] [SUB] at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:91)
[Thu Mar 25 10:40:26 IST 2021][INFO] [SUB] at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124)
[Thu Mar 25 10:40:26 IST 2021][INFO] [SUB] at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_ARRAY:Ljava_lang_Runnable_2_0002erun_00028_00029V(generated:0)
[Thu Mar 25 10:40:26 IST 2021][INFO] [SUB] Error: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved method during parsing: com.fasterxml.jackson.databind.DeserializationContext.extractScalarFromObject(com.fasterxml.jackson.core.JsonParser, com.fasterxml.jackson.databind.JsonDeserializer, java.lang.Class). To diagnose the issue you can use the --allow-incomplete-classpath option. The missing method is then reported at run time when it is accessed the first time.
[Thu Mar 25 10:40:26 IST 2021][INFO] [SUB] Trace:
[Thu Mar 25 10:40:26 IST 2021][INFO] [SUB] at parsing com.fasterxml.jackson.datatype.jsr310.deser.InstantDeserializer.deserialize(InstantDeserializer.java:213)
[Thu Mar 25 10:40:26 IST 2021][INFO] [SUB] Call path from entry point to com.fasterxml.jackson.datatype.jsr310.deser.InstantDeserializer.deserialize(JsonParser, DeserializationContext):
[Thu Mar 25 10:40:26 IST 2021][INFO] [SUB] at com.fasterxml.jackson.datatype.jsr310.deser.InstantDeserializer.deserialize(InstantDeserializer.java:202)
[Thu Mar 25 10:40:26 IST 2021][INFO] [SUB] at com.fasterxml.jackson.datatype.jsr310.deser.InstantDeserializer.deserialize(InstantDeserializer.java:50)
[Thu Mar 25 10:40:26 IST 2021][INFO] [SUB] at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4482)
[Thu Mar 25 10:40:26 IST 2021][INFO] [SUB] at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3434)
[Thu Mar 25 10:40:26 IST 2021][INFO] [SUB] at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3402)
[Thu Mar 25 10:40:26 IST 2021][INFO] [SUB] at hellofx.HelloFX.deserialize(HelloFX.java:99)
[Thu Mar 25 10:40:26 IST 2021][INFO] [SUB] at com.oracle.svm.reflect.HelloFX_deserialize_15f8adc753d5dce15c2070972d1be99d7c98ca42_239.invoke(Unknown Source)
[Thu Mar 25 10:40:26 IST 2021][INFO] [SUB] at java.lang.reflect.Method.invoke(Method.java:566)
[Thu Mar 25 10:40:26 IST 2021][INFO] [SUB] at com.sun.prism.GraphicsPipeline.createPipeline(GraphicsPipeline.java:224)
[Thu Mar 25 10:40:26 IST 2021][INFO] [SUB] at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:91)
[Thu Mar 25 10:40:26 IST 2021][INFO] [SUB] at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124)
[Thu Mar 25 10:40:26 IST 2021][INFO] [SUB] at
Here's the full log.
I've tested the app without using 'LocalDate' and 'JavaTimeModule' and I was able to build APK and parsing also worked.
Here's the full pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>hellofx</groupId>
<artifactId>hellofx</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>HelloFX</name>
<properties>
<main.class>hellofx.HelloFX</main.class>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.release>11</maven.compiler.release>
<javafx.version>15.0.1</javafx.version>
<javafx.maven.plugin.version>0.0.5</javafx.maven.plugin.version>
<client.maven.plugin.version>0.1.38</client.maven.plugin.version>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>${javafx.version}</version>
</dependency>
<!-- Added jackson dependency here -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.11.1</version>
</dependency>
<!-- Added JavaTime data type -->
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>2.12.2</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.maven.plugin.version}</version>
<configuration>
<mainClass>${main.class}</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>com.gluonhq</groupId>
<artifactId>client-maven-plugin</artifactId>
<version>${client.maven.plugin.version}</version>
<configuration>
<target>${client.target}</target>
<mainClass>${main.class}</mainClass>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>desktop</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<client.target>host</client.target>
</properties>
</profile>
<profile>
<id>ios</id>
<properties>
<client.target>ios</client.target>
</properties>
</profile>
<profile>
<id>android</id>
<properties>
<client.target>android</client.target>
</properties>
</profile>
</profiles>
</project>
How to solve this issue?
Update #1:-
All JSON config files are already created using 'client:runagent' goal:-
In the previous question regarding this issue, Jose Pereda instructed me to use 'mvn client:runagent'. Since I am using Ubuntu in WSL, I've run this goal in windows command prompt and edited some config files to remove windows specific configurations.
Jackson isn't causing the issue, 'JavaTimeModule' is:-
I've removed the LocalDate 'dob' property from 'Person' and commented out the following in HelloFX.java.
mapper.registerModule(new JavaTimeModule());
After that, I was able to build and run APK, and both serialization and deserialization worked.
And I've also tried manually adding 'reflectionconfig.json' under substrate folder as suggested by dzim. But the same issue occurs.
Long answer for You need to update your reflection config. (since that is, what Jackson is doing and GraalVM needs to know about it, since it is pre-compiled).
Documentation
Most importantly: Make sure you've read the documentation provided by Gluon.
It describes in detail, what you could do.
client:runagent
The topic client:runagent describes, that you could attach GraalVM's agent to detect all reflection and so on.
I did this manually and it worked well. But it is
a) exchaustive and
b) does too much.
Gluon already prepared everything related to JavaFX, so you only need to add your specific stuff.
Configuration
See here to find more general details about what you need to do in case of your app needs some additional configuration.
This isn't only about reflection but anything else (target platforms, resources, platform specific build information, etc.).
Your actual problem
Reflection Config
I have a little application using Jackson as well.
Under your maven resources (src/main/resources) add META-INF/substrate/config.
Add a json file named reflectionconfig.json and add the following content:
[
{
"name": "com.fasterxml.jackson.databind.ObjectMapper",
"methods": [
{ "name": "<init>", "parameterTypes": [] },
{ "name": "<init>", "parameterTypes": ["com.fasterxml.jackson.core.JsonFactory"] }
]
}
]
This tells GraalVM (I think, I'm not 100% sure about it, tbh), that it need to initialize this class and the specified methods for reflection in the resulting AOT native executable.
pom.xml
Update your client-maven-plugin <configuration> section to contain more information about the classes you want to de-/serialize with Jackson.
<configuration>
<!-- ... main class, etc. -->
<reflectionList>
<!-- ... -->
<!-- our own JSON data classes below -->
<!-- more Jackson stuff -->
<list>com.fasterxml.jackson.core.JsonFactory</list>
<!-- ... -->
</reflectionList>
</configuration>
Summary
At least im my application that's enough.
If you add dependencies like Ikonli you need more configs. Everything (your own code as well) that directly or indirectly uses reflection, needs to be added in the one place (reflection config) or the other (pom.xml).
For example: If you use FXMLs, your controller and all widgets used in the FXMLs need to be added to the pom.xml as well, as far as I know.
Cheers
Edit on 30.03.2021
First of all: Sorry to hear that you still struggle with it. And I kinda missed the part about the Jackson JavaTimeModule...
From another dev I once got the tipp, to add the following parameter to your native-image arguments -H:+AllowIncompleteClasspath (see here).
Also the generated files sometimes need some adjustments in order for them to work: most of the time remove some links to graalvm itself, or com.sun stuff.
Yesterday I struggled a bit with Kotlin-Reflect and I needed to actually add some reflections and resources. This could also be the case.
I don't know if this would work, but you could try and add the mentioned method manually to the reflection config JSON:
[
{
"name":"com.fasterxml.jackson.databind.DeserializationContext",
"methods":[{"name":"extractScalarFromObject","parameterTypes":["com.fasterxml.jackson.core.JsonParser","com.fasterxml.jackson.databind.JsonDeserializer","java.lang.Class"] }]
}
]
Maybe adding some resources to the JSON config might help, as well:
{
"resources":{
"includes":[
// others
{"pattern":"META-INF/services/.*"}
]},
"bundles":[]
}
Why? Because there's a service loader definition in the module. See here
But to be honest: without actually having an application where I could try that (and no, I don't try to recreate yours here), I might not be able to deliver the final missing piece...
¯\(ツ)/¯