title: GraalVM javafx.fxml.LoadException: Error resolving onAction='#loginAction', either the event handler is not in the Namespace
body: <p>I'm running into an error running the native image produced by GraalVM (latest GraalVM built on JDK 11) via the Gluon Client Plugin.</p>
  
  <blockquote>
    <p>javafx.fxml.LoadException: Error resolving onAction='#loginAction', either the event handler is not in the Namespace or there is an error in the script. fxml/LoginScreen.fxml:17</p>
  </blockquote>
  
  <p>The compililation step works fine:</p>
  
  <blockquote>
    <p>mvn clean client:build</p>
  </blockquote>
  
  <p>I see the binary in a folder called "<em>projectname</em>/target/client/x86_64-linux/<em>binaryname</em>"</p>
  
  <p>The above error produced when I run the executable via "./<em>binaryname</em>"</p>
  
  <p>The FXML line of code which its complaining about on line 17 is:</p>
  
  <pre><code>&lt;Button fx:id="_loginButton" layoutX="516.0" layoutY="174.0" mnemonicParsing="false" onAction="#loginAction" prefHeight="28.0" prefWidth="94.0" text="Login" /&gt;
  </code></pre>
  
  <p>The backing code logic are as follows and marked with @FXML:</p>
  
  <pre><code>@FXML
  void loginAction(ActionEvent event) throws InterruptedException {
  
      LoginService loginservice = new LoginService(_usernameTextField.getText(), _passwordTextField.getText());
  </code></pre>
  
  <p>According to a JavaFX common errors list the problem is usually because the onAction event does not have the same name as specified in the controller - <a href="http://icarus.cs.weber.edu/~rball/JavaBook/JavaFXBook.pdf" rel="nofollow noreferrer">Introduction to JavaFX
  for Beginner Programmers - Pg 27 </a>. However this is not the case, my program's naming is accurate. Using the JavaFX maven plugin (seperate from the GluonClient) using </p>
  
  <blockquote>
    <p>maven javafx:run</p>
  </blockquote>
  
  <p>the program starts up correctly and works as expected. If I need to post more information, please let me know.</p>
  
  <p>Here is my pom.xml (I only replaced only the name of my package below)</p>
  
  <pre><code>&lt;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 https://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  &lt;groupId&gt;com.demo&lt;/groupId&gt;
  &lt;artifactId&gt;com-demo-management-ui&lt;/artifactId&gt;
  &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
  
  &lt;properties&gt;
      &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
      &lt;maven.compiler.source&gt;11&lt;/maven.compiler.source&gt;
      &lt;maven.compiler.target&gt;11&lt;/maven.compiler.target&gt;
      &lt;client.plugin.version&gt;0.1.26&lt;/client.plugin.version&gt;
  &lt;/properties&gt;
  
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.openjfx&lt;/groupId&gt;
          &lt;artifactId&gt;javafx-controls&lt;/artifactId&gt;
          &lt;version&gt;11&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- https://mvnrepository.com/artifact/org.openjfx/javafx-fxml --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.openjfx&lt;/groupId&gt;
          &lt;artifactId&gt;javafx-fxml&lt;/artifactId&gt;
          &lt;version&gt;11&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.httpcomponents&lt;/groupId&gt;
          &lt;artifactId&gt;httpclient&lt;/artifactId&gt;
          &lt;version&gt;4.5.12&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- https://mvnrepository.com/artifact/com.google.code.gson/gson --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.google.code.gson&lt;/groupId&gt;
          &lt;artifactId&gt;gson&lt;/artifactId&gt;
          &lt;version&gt;2.8.6&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- https://mvnrepository.com/artifact/commons-io/commons-io --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;commons-io&lt;/groupId&gt;
          &lt;artifactId&gt;commons-io&lt;/artifactId&gt;
          &lt;version&gt;2.6&lt;/version&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  &lt;build&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
              &lt;version&gt;3.8.1&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;release&gt;11&lt;/release&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.openjfx&lt;/groupId&gt;
              &lt;artifactId&gt;javafx-maven-plugin&lt;/artifactId&gt;
              &lt;version&gt;0.0.3&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;mainClass&gt;com.demo.Launcher&lt;/mainClass&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;com.gluonhq&lt;/groupId&gt;
              &lt;artifactId&gt;client-maven-plugin&lt;/artifactId&gt;
              &lt;version&gt;${client.plugin.version}&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;!-- Uncomment to run on iOS: --&gt;
                  &lt;!-- &lt;target&gt;ios&lt;/target&gt; --&gt;
                  &lt;mainClass&gt;com.demo.Launcher&lt;/mainClass&gt;
                  &lt;graalvmHome&gt;/opt/graalvm-ce-java11-20.2.0-dev/&lt;/graalvmHome&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  
  &lt;pluginRepositories&gt;
      &lt;pluginRepository&gt;
          &lt;id&gt;gluon-releases&lt;/id&gt;
          &lt;url&gt;http://nexus.gluonhq.com/nexus/content/repositories/releases/&lt;/url&gt;
      &lt;/pluginRepository&gt;
  &lt;/pluginRepositories&gt;
  </code></pre>
  
  <p></p>
  
  <p>And finally, here is the code where I set the controller (This is a method call, which I exchange my views as I need them, thus controller is passed as an argument in the creating a view):</p>
  
  <pre><code>        FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/fxml/"+baseController.getFxmlFile()));
          fxmlLoader.setController(baseController);
          Parent parent =  fxmlLoader.load();
          Scene scene = new Scene(parent);
          Stage stage = new Stage();
          stage.setFullScreen(fullScreen);
          stage.setMaximized(setMaximized);
          stage.setScene(scene);
          stage.show();
  </code></pre>