Reputation: 65
Here's the FXML file:
<?import com.gluonhq.charm.glisten.control.CardPane?>
<?import com.gluonhq.charm.glisten.mvc.View?>
<?import javafx.scene.layout.BorderPane?>
<View fx:id="myView" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="335.0" xmlns="http://javafx.com/javafx/16" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.mydomain.view.MyPresenter">
<center>
<BorderPane prefHeight="591.0" prefWidth="322.0" BorderPane.alignment="CENTER">
<center>
<CardPane fx:id="cardPane" prefHeight="465.0" prefWidth="333.0" />
</center>
</BorderPane>
</center>
</View>
If I mvn gluonfx:run
then it works fine. I see the CardPane. I can add cards to it. I see it update its list of cards as expected.
But if I then try to mvn gluonfx:nativerun
I fail with ClassNotFoundException: com.gluonhq.charm.glisten.control.CardPane
Here's an excerpt of the commandline callstack:
Caused by: javafx.fxml.LoadException:
[Wed Jul 21 09:59:25 MST 2021][INFO] [SUB] com/mydomain/view/myView.fxml
[Wed Jul 21 09:59:25 MST 2021][INFO] [SUB]
[Wed Jul 21 09:59:25 MST 2021][INFO] [SUB] at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2707)
[Wed Jul 21 09:59:25 MST 2021][INFO] [SUB] at javafx.fxml.FXMLLoader.importClass(FXMLLoader.java:2949)
[Wed Jul 21 09:59:25 MST 2021][INFO] [SUB] at javafx.fxml.FXMLLoader.processImport(FXMLLoader.java:2793)
[Wed Jul 21 09:59:25 MST 2021][INFO] [SUB] at javafx.fxml.FXMLLoader.processProcessingInstruction(FXMLLoader.java:2758)
[Wed Jul 21 09:59:25 MST 2021][INFO] [SUB] at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2624)
[Wed Jul 21 09:59:25 MST 2021][INFO] [SUB] at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2548)
[Wed Jul 21 09:59:25 MST 2021][INFO] [SUB] at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2516)
[Wed Jul 21 09:59:25 MST 2021][INFO] [SUB] at com.airhacks.afterburner.views.FXMLView.loadSynchronously(FXMLView.java:91)
[Wed Jul 21 09:59:25 MST 2021][INFO] [SUB] ... 21 more
[Wed Jul 21 09:59:25 MST 2021][INFO] [SUB] Caused by: java.lang.ClassNotFoundException: com.gluonhq.charm.glisten.control.CardPane
[Wed Jul 21 09:59:25 MST 2021][INFO] [SUB] at com.oracle.svm.core.hub.ClassForNameSupport.forName(ClassForNameSupport.java:71)
[Wed Jul 21 09:59:25 MST 2021][INFO] [SUB] at java.lang.ClassLoader.loadClass(ClassLoader.java:212)
[Wed Jul 21 09:59:25 MST 2021][INFO] [SUB] at javafx.fxml.FXMLLoader.loadTypeForPackage(FXMLLoader.java:3017)
[Wed Jul 21 09:59:25 MST 2021][INFO] [SUB] at javafx.fxml.FXMLLoader.loadType(FXMLLoader.java:3006)
[Wed Jul 21 09:59:25 MST 2021][INFO] [SUB] at javafx.fxml.FXMLLoader.importClass(FXMLLoader.java:2947)
Upvotes: 0
Views: 255
Reputation: 11
adding to Javateer, maybe just simply add to the reflection lists all your imports:
<reflectionList>
<list>javafx.scene.control.ListView</list>
<list>javafx.scene.control.SplitPane</list>
<list>javafx.scene.control.ButtonBar</list>
<list>javafx.scene.layout.AnchorPane</list>
<list>javafx.scene.layout.ColumnConstraints</list>
<list>javafx.scene.layout.GridPane</list>
<list>javafx.scene.layout.HBox</list>
<list>javafx.scene.control.Menu</list>
<list>javafx.scene.control.MenuBar</list>
<!-- <list>javafx.scene.control.MenuItem</list>-->
<list>javafx.scene.layout.RowConstraints</list>
<list>org.travelonline.guidemo.persongui.FXApplication</list>
<list>org.travelonline.guidemo.persongui.FXController</list>
</reflectionList>
based on my imports in fxml file below:
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ListView?>
<?import javafx.scene.control.Menu?>
<?import javafx.scene.control.MenuBar?>
<?import javafx.scene.control.MenuItem?>
<?import javafx.scene.control.SplitPane?>
<?import javafx.scene.control.TextArea?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.control.ButtonBar?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.RowConstraints?>
Upvotes: 0
Reputation: 65
Thanks @JoséPereda for nudging me where to go look next. New questions came up along the way but I finially got the app working in native run mode.
However, I then realized my noob mistake. I had forgotten to keep going back to the project pom file to update the reflectionList of the gluon plugin. So, I undid the messy fix with underlying config files and then just updated as follows below. I show you the platform widgets I needed to mention per the stacktrace feedback I was seeing. I also listed my own classes but don't bother showing those here too.
<artifactId>gluonfx-maven-plugin</artifactId>
<version>${gluonfx.plugin.version}</version>
<configuration>
<reflectionList>
<list>javafx.scene.control.DatePicker</list>
<list>com.gluonhq.charm.glisten.control.CardPane</list>
Upvotes: 0