gluonfx-gradle-plugin icon indicating copy to clipboard operation
gluonfx-gradle-plugin copied to clipboard

Include of FXML doesn't work

Open hallvard opened this issue 5 years ago • 2 comments

I have one FXML file including another with the following FXML code (line 23 in FxApp.fxml): <fx:include fx:id="fileMenu" source="FileMenu.fxml"/> It works when launching normally, but when run with gradle nativeRun I get the following message:

[SUB] Exception in thread "System-0" java.lang.RuntimeException: Exception in Application start method
[SUB]   at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:900)
[SUB]   at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
[SUB]   at java.lang.Thread.run(Thread.java:834)
[SUB]   at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:473)
[SUB]   at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:193)
[SUB] Caused by: javafx.fxml.LoadException:
[SUB] multiex/ui/FileMenu.fxml:23
[SUB] multiex/ui/FxApp.fxml:23
[SUB]
[SUB]   at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2625)
[SUB]   at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2603)
[SUB]   at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2466)
[SUB]   at javafx.fxml.FXMLLoader$IncludeElement.constructValue(FXMLLoader.java:1154)
[SUB]   at javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:754)
[SUB]   at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2722)
[SUB]   at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2552)
[SUB]   at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2466)
[SUB]   at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2435)
[SUB]   at multiex.ui.FxApp.start(FxApp.java:15)
[SUB]   at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
[SUB]   at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
[SUB]   at com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
[SUB]   at java.security.AccessController.doPrivileged(AccessController.java:73)
[SUB]   at com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
[SUB]   at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
[SUB]   at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_VARARGS:Ljava_lang_Runnable_2_0002erun_00028_00029V(JNIJavaCallWrappers.java:0)
[SUB] Caused by: java.io.IOException: Including "resource:multiex/ui/FileMenu.fxml" in "resource:multiex/ui/FileMenu.fxml" created cyclic reference.
[SUB]   at javafx.fxml.FXMLLoader$IncludeElement.constructValue(FXMLLoader.java:1146)
[SUB]   at javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:754)

There is no cyclic reference, it seems the loader mixes up the fxml files. It is as if it loads the same file again, but thinks it has the other (correct) file's name.

The project files are here: https://github.com/hallvard/it1901-example/tree/master/multiexample/fx/src/main/resources/multiex/ui

hallvard avatar Jun 06 '19 14:06 hallvard

Thanks for reporting, I can reproduce the issue.

jperedadnr avatar Jun 06 '19 16:06 jperedadnr

I'm running into the same issue. With client-maven-plugin against openjfx 11 - 15-ea+4

orx0815 avatar May 04 '20 13:05 orx0815