Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot run native image for JavaFX+Spring Boot project #173

Closed
palexdev opened this issue Jun 4, 2023 · 3 comments
Closed

Cannot run native image for JavaFX+Spring Boot project #173

palexdev opened this issue Jun 4, 2023 · 3 comments

Comments

@palexdev
Copy link

palexdev commented Jun 4, 2023

I have an app built with Spring Boot and JavaFX. I need to distribute my app on all major platforms, and I'd like to use GraalVM to generate native images. However, little did I know the process would be so underwhelming, I tried everything, but I can't make this work, it's so difficult

I have made a little reproducer, available here: Reproducer.zip

I can't run the app because I get this exception:

[Sun Jun 04 12:32:02 CEST 2023][INFO] ==================== LINK TASK ====================
[Sun Jun 04 12:32:03 CEST 2023][INFO] [SUB] Jun 04, 2023 12:32:03 PM com.sun.javafx.application.PlatformImpl startup
[Sun Jun 04 12:32:03 CEST 2023][INFO] [SUB] WARNING: Unsupported JavaFX configuration: classes were loaded from 'unnamed module @71c7db30'
[Sun Jun 04 12:32:04 CEST 2023][INFO] [SUB] Exception in Application constructor
[Sun Jun 04 12:32:04 CEST 2023][INFO] [SUB] Exception in thread "main" java.lang.RuntimeException: Unable to construct Application instance: class io.github.palexdev.reproducer.Reproducer
[Sun Jun 04 12:32:04 CEST 2023][INFO] [SUB] 	at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:883)
[Sun Jun 04 12:32:04 CEST 2023][INFO] [SUB] 	at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
[Sun Jun 04 12:32:04 CEST 2023][INFO] [SUB] 	at java.lang.Thread.run(Thread.java:833)
[Sun Jun 04 12:32:04 CEST 2023][INFO] [SUB] 	at com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:704)
[Sun Jun 04 12:32:04 CEST 2023][INFO] [SUB] 	at com.oracle.svm.core.posix.thread.PosixPlatformThreads.pthreadStartRoutine(PosixPlatformThreads.java:202)
[Sun Jun 04 12:32:04 CEST 2023][INFO] [SUB] Caused by: java.lang.NoSuchMethodException: io.github.palexdev.reproducer.Reproducer.<init>()
[Sun Jun 04 12:32:04 CEST 2023][INFO] [SUB] 	at java.lang.Class.getConstructor0(DynamicHub.java:3585)
[Sun Jun 04 12:32:04 CEST 2023][INFO] [SUB] 	at java.lang.Class.getConstructor(DynamicHub.java:2271)
[Sun Jun 04 12:32:04 CEST 2023][INFO] [SUB] 	at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$8(LauncherImpl.java:794)
[Sun Jun 04 12:32:04 CEST 2023][INFO] [SUB] 	at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:483)
[Sun Jun 04 12:32:04 CEST 2023][INFO] [SUB] 	at com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:456)
[Sun Jun 04 12:32:04 CEST 2023][INFO] [SUB] 	at java.security.AccessController.executePrivileged(AccessController.java:169)
[Sun Jun 04 12:32:04 CEST 2023][INFO] [SUB] 	at java.security.AccessController.doPrivileged(AccessController.java:399)
[Sun Jun 04 12:32:04 CEST 2023][INFO] [SUB] 	at com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:455)
[Sun Jun 04 12:32:04 CEST 2023][INFO] [SUB] 	at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
[Sun Jun 04 12:32:04 CEST 2023][INFO] [SUB] 	at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_VA_LIST_Runnable_run_16403f8d32adb631126daa893e5e80085c5d6325(JNIJavaCallWrappers.java:0)
[Sun Jun 04 12:32:04 CEST 2023][INFO] [SUB] 	at com.sun.glass.ui.gtk.GtkApplication._runLoop(GtkApplication.java)
[Sun Jun 04 12:32:04 CEST 2023][INFO] [SUB] 	at com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$11(GtkApplication.java:316)
[Sun Jun 04 12:32:04 CEST 2023][INFO] [SUB] 	... 3 more
[Sun Jun 04 12:32:03 CEST 2023][INFO] ==================== RUN TASK ====================

Also note that I can't run the nativeRunAgent task because I recieve an exception of type UnsupportedOperationException with no message, so I don't know what's causing it

@palexdev
Copy link
Author

YOOOO?? ANYBODY HERE??? Where the heck is support? There is a mountain of issue here without any answer
I believe #159 needs to be merged ASAP

@palexdev palexdev closed this as not planned Won't fix, can't repro, duplicate, stale Jun 16, 2023
@alextim1508
Copy link

Hi! Have you solved the problem?

@palexdev
Copy link
Author

Hi! Have you solved the problem?

Yes, by not using Spring, replaced by Inverno

Also, if you wanna know the outcome, I was able to consistently build native images but they are very buggy
So I ended up using JLink

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants