title: Handler method not found - JavaFX
body: <p>I´ve been having a little bit of trouble with this interface, i have this fxml file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;?import java.lang.String?&gt;
  &lt;?import javafx.scene.Cursor?&gt;
  &lt;?import javafx.scene.control.Button?&gt;
  &lt;?import javafx.scene.control.Label?&gt;
  &lt;?import javafx.scene.control.TextField?&gt;
  &lt;?import javafx.scene.image.Image?&gt;
  &lt;?import javafx.scene.image.ImageView?&gt;
  &lt;?import javafx.scene.layout.AnchorPane?&gt;
  &lt;?import javafx.scene.text.Font?&gt;
  
  &lt;AnchorPane id="AnchorPane" prefHeight="600.0" prefWidth="1000.0" stylesheets="@Stylesheets/styles.css" xmlns="http://javafx.com/javafx/9.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="guichat.HomeController"&gt;
     &lt;children&gt;
        &lt;AnchorPane layoutX="250.0" layoutY="64.0" prefHeight="200.0" prefWidth="200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="32.0"&gt;
           &lt;children&gt;
              &lt;AnchorPane maxWidth="64.0" minWidth="64.0" prefHeight="200.0" prefWidth="64.0" styleClass="sidebar" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="0.0"&gt;
                 &lt;children&gt;
                    &lt;Button layoutY="2.0" maxHeight="64.0" maxWidth="64.0" minHeight="64.0" minWidth="64.0" mnemonicParsing="false" prefHeight="64.0" prefWidth="64.0" styleClass="sidebar-btn" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"&gt;
                       &lt;font&gt;
                          &lt;Font name="Century Gothic Bold" size="13.0" /&gt;
                       &lt;/font&gt;
                       &lt;graphic&gt;
                          &lt;ImageView fitHeight="24.0" fitWidth="24.0" pickOnBounds="true" preserveRatio="true"&gt;
                             &lt;image&gt;
                                &lt;Image url="@Assets/msg.png" /&gt;
                             &lt;/image&gt;
                          &lt;/ImageView&gt;
                       &lt;/graphic&gt;
                       &lt;cursor&gt;
                          &lt;Cursor fx:constant="HAND" /&gt;
                       &lt;/cursor&gt;
                    &lt;/Button&gt;
                    &lt;Button layoutY="64.0" maxHeight="64.0" maxWidth="64.0" minHeight="64.0" minWidth="64.0" mnemonicParsing="false" prefHeight="64.0" prefWidth="64.0" styleClass="sidebar-btn"&gt;
                       &lt;font&gt;
                          &lt;Font name="Century Gothic Bold" size="13.0" /&gt;
                       &lt;/font&gt;
                       &lt;graphic&gt;
                          &lt;ImageView fitHeight="24.0" fitWidth="24.0" pickOnBounds="true" preserveRatio="true"&gt;
                             &lt;image&gt;
                                &lt;Image url="@Assets/addfriend.png" /&gt;
                             &lt;/image&gt;
                          &lt;/ImageView&gt;
                       &lt;/graphic&gt;
                       &lt;cursor&gt;
                          &lt;Cursor fx:constant="HAND" /&gt;
                       &lt;/cursor&gt;
                    &lt;/Button&gt;
                    &lt;Button layoutX="-14.0" layoutY="136.0" maxHeight="64.0" maxWidth="64.0" minHeight="64.0" minWidth="64.0" mnemonicParsing="false" prefHeight="64.0" prefWidth="64.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="128.0"&gt;
                       &lt;font&gt;
                          &lt;Font name="Century Gothic Bold" size="13.0" /&gt;
                       &lt;/font&gt;
                       &lt;graphic&gt;
                          &lt;ImageView fitHeight="24.0" fitWidth="24.0" pickOnBounds="true" preserveRatio="true"&gt;
                             &lt;image&gt;
                                &lt;Image url="@Assets/addgroup.png" /&gt;
                             &lt;/image&gt;
                          &lt;/ImageView&gt;
                       &lt;/graphic&gt;
                       &lt;cursor&gt;
                          &lt;Cursor fx:constant="HAND" /&gt;
                       &lt;/cursor&gt;
                       &lt;styleClass&gt;
                          &lt;String fx:value="sidebar-btn" /&gt;
                          &lt;String fx:value="sidebar-active" /&gt;
                       &lt;/styleClass&gt;
                    &lt;/Button&gt;
                    &lt;Button fx:id="outBtn" layoutY="504.0" maxHeight="64.0" maxWidth="64.0" minHeight="64.0" minWidth="64.0" mnemonicParsing="false" onAction="#signOut" prefHeight="64.0" prefWidth="64.0" styleClass="sidebar-btn" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="504.0"&gt;
                       &lt;font&gt;
                          &lt;Font name="Century Gothic Bold" size="13.0" /&gt;
                       &lt;/font&gt;
                       &lt;graphic&gt;
                          &lt;ImageView fitHeight="24.0" fitWidth="24.0" pickOnBounds="true" preserveRatio="true"&gt;
                             &lt;image&gt;
                                &lt;Image url="@Assets/out.png" /&gt;
                             &lt;/image&gt;
                          &lt;/ImageView&gt;
                       &lt;/graphic&gt;
                       &lt;cursor&gt;
                          &lt;Cursor fx:constant="HAND" /&gt;
                       &lt;/cursor&gt;
                    &lt;/Button&gt;
                    &lt;Button layoutY="192.0" maxHeight="64.0" maxWidth="64.0" minHeight="64.0" minWidth="64.0" mnemonicParsing="false" prefHeight="64.0" prefWidth="64.0" styleClass="sidebar-btn" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="192.0"&gt;
                       &lt;font&gt;
                          &lt;Font name="Century Gothic Bold" size="13.0" /&gt;
                       &lt;/font&gt;
                       &lt;graphic&gt;
                          &lt;ImageView fitHeight="24.0" fitWidth="24.0" pickOnBounds="true" preserveRatio="true"&gt;
                             &lt;image&gt;
                                &lt;Image url="@Assets/notification.png" /&gt;
                             &lt;/image&gt;
                          &lt;/ImageView&gt;
                       &lt;/graphic&gt;
                       &lt;cursor&gt;
                          &lt;Cursor fx:constant="HAND" /&gt;
                       &lt;/cursor&gt;
                    &lt;/Button&gt;
                 &lt;/children&gt;
              &lt;/AnchorPane&gt;
              &lt;AnchorPane layoutX="64.0" prefHeight="200.0" prefWidth="300.0" styleClass="group" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="64.0" AnchorPane.topAnchor="0.0"&gt;
                 &lt;children&gt;
                    &lt;AnchorPane prefHeight="64.0" prefWidth="236.0" styleClass="border-bottom" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"&gt;
                       &lt;children&gt;
                          &lt;Label layoutX="95.0" layoutY="28.0" text="Crear Grupo" textFill="#f2f7f7"&gt;
                             &lt;font&gt;
                                &lt;Font name="Century Gothic Bold" size="18.0" /&gt;
                             &lt;/font&gt;
                          &lt;/Label&gt;
                       &lt;/children&gt;
                    &lt;/AnchorPane&gt;
                    &lt;AnchorPane layoutY="84.0" prefHeight="484.0" prefWidth="236.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="64.0"&gt;
                       &lt;children&gt;
                          &lt;TextField layoutX="10.0" layoutY="166.0" prefHeight="32.0" AnchorPane.leftAnchor="10.0" AnchorPane.rightAnchor="10.0"&gt;
                             &lt;font&gt;
                                &lt;Font name="Century Gothic" size="12.0" /&gt;
                             &lt;/font&gt;
                          &lt;/TextField&gt;
                          &lt;Label layoutX="10.0" layoutY="134.0" prefHeight="32.0" text="Nombre del Grupo:" textFill="#f2f7f7" AnchorPane.leftAnchor="10.0" AnchorPane.rightAnchor="10.0"&gt;
                             &lt;font&gt;
                                &lt;Font name="Century Gothic Bold" size="13.0" /&gt;
                             &lt;/font&gt;
                          &lt;/Label&gt;
                          &lt;TextField layoutX="10.0" layoutY="261.0" prefHeight="32.0" AnchorPane.leftAnchor="10.0" AnchorPane.rightAnchor="10.0"&gt;
                             &lt;font&gt;
                                &lt;Font name="Century Gothic" size="12.0" /&gt;
                             &lt;/font&gt;
                          &lt;/TextField&gt;
                          &lt;Label layoutX="10.0" layoutY="229.0" prefHeight="32.0" text="Creador:" textFill="#f2f7f7" AnchorPane.leftAnchor="10.0" AnchorPane.rightAnchor="10.0"&gt;
                             &lt;font&gt;
                                &lt;Font name="Century Gothic Bold" size="13.0" /&gt;
                             &lt;/font&gt;
                          &lt;/Label&gt;
                          &lt;Button fx:id="createGroupBtn" layoutX="10.0" layoutY="339.0" maxHeight="32.0" minHeight="32.0" mnemonicParsing="false" onAction="#createGroup" prefHeight="32.0" styleClass="btn-green" text="CREAR GRUPO" textFill="#fffefe" AnchorPane.leftAnchor="10.0" AnchorPane.rightAnchor="10.0"&gt;
                             &lt;font&gt;
                                &lt;Font name="Century Gothic Bold" size="13.0" /&gt;
                             &lt;/font&gt;
                          &lt;/Button&gt;
                       &lt;/children&gt;
                    &lt;/AnchorPane&gt;
                 &lt;/children&gt;
              &lt;/AnchorPane&gt;
           &lt;/children&gt;
        &lt;/AnchorPane&gt;
        &lt;AnchorPane fx:id="headerBar" layoutX="10.0" layoutY="10.0" prefHeight="32.0" prefWidth="200.0" style="-fx-background-color: #303841;" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"&gt;
           &lt;children&gt;
              &lt;Button fx:id="closeWindowBtn" layoutX="968.0" layoutY="4.0" maxWidth="32.0" minWidth="32.0" mnemonicParsing="false" onAction="#handleCloseWindow" prefWidth="32.0" styleClass="close" text="x" textFill="WHITE" AnchorPane.bottomAnchor="1.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="-2.0"&gt;
                 &lt;font&gt;
                    &lt;Font name="Century Gothic Bold" size="13.0" /&gt;
                 &lt;/font&gt;
                 &lt;cursor&gt;
                    &lt;Cursor fx:constant="HAND" /&gt;
                 &lt;/cursor&gt;
              &lt;/Button&gt;
              &lt;Button fx:id="minimizeWindowBtn" layoutX="936.0" layoutY="4.0" maxWidth="32.0" minWidth="32.0" mnemonicParsing="false" onAction="#handleMinimizeWindow" prefWidth="32.0" styleClass="close" text="-" textFill="WHITE" AnchorPane.bottomAnchor="1.0" AnchorPane.rightAnchor="32.0" AnchorPane.topAnchor="-2.0"&gt;
                 &lt;font&gt;
                    &lt;Font name="Century Gothic Bold" size="13.0" /&gt;
                 &lt;/font&gt;
                 &lt;cursor&gt;
                    &lt;Cursor fx:constant="HAND" /&gt;
                 &lt;/cursor&gt;
              &lt;/Button&gt;
           &lt;/children&gt;
        &lt;/AnchorPane&gt;
     &lt;/children&gt;
  &lt;/AnchorPane&gt;
  </code></pre>
  
  <p>And this is my controller with all the methods:
  NOTE: All the functions work perfectly fine, just the createGroup method doesn't work.</p>
  
  <pre><code>package guichat;
  
  import java.io.IOException;
  import java.net.URL;
  import java.util.ResourceBundle;
  import javafx.event.ActionEvent;
  import javafx.fxml.FXML;
  import javafx.fxml.FXMLLoader;
  import javafx.fxml.Initializable;
  import javafx.scene.Scene;
  import javafx.scene.control.Button;
  import javafx.stage.Stage;
  
  /**
   * FXML Controller class
   *
   * @author Wero
   */
  public class GroupsController implements Initializable {
  
  
      @FXML private Button closeWindowBtn, minimizeWindowBtn, createGroupBtn, outBtn;
  
  
      @FXML
      public void handleCloseWindow(ActionEvent e){
          Stage stage = (Stage) closeWindowBtn.getScene().getWindow();
          stage.close();
      }
  
  
      @FXML
      public void handleMinimizeWindow(ActionEvent e){
          Stage stage = (Stage) minimizeWindowBtn.getScene().getWindow();
          stage.setIconified(true);
      }
  
  
      @FXML
      public void createGroup(ActionEvent e){
          try {
              FXMLLoader loader = new FXMLLoader(getClass().getResource("Home.fxml"));
              Stage stage = (Stage) outBtn.getScene().getWindow();
              Scene scene = new Scene(loader.load());
              stage.setScene(scene);
          }catch (IOException io){
              io.printStackTrace();
          }
      }
  
  
      @FXML
      public void signOut(ActionEvent e){
          try {
              FXMLLoader loader = new FXMLLoader(getClass().getResource("Login.fxml"));
              Stage stage = (Stage) outBtn.getScene().getWindow();
              Scene scene = new Scene(loader.load());
              stage.setScene(scene);
          }catch (IOException io){
              io.printStackTrace();
          }
      }
  
      /**
       * Initializes the controller class.
       */
      @Override
      public void initialize(URL url, ResourceBundle rb) {
          // TODO
          System.out.println("Interface ready!!");
      }    
  
  }
  </code></pre>
  
  <p>Well, i'm for example in the mi interface where the user can send messages and then i try to press the button to go to the interface of "Groups" but netbeans throw me this error:</p>
  
  <pre><code> javafx.fxml.LoadException: Error resolving onAction='#createGroup', either the event handler is not in the Namespace or there is an error in the script.
  file:/C:/Users/Wero/Documents/GitHub/cliente/GUIChat/dist/run1706281368/GUIChat.jar!/guichat/Groups.fxml:137
  
  at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2597)
  at javafx.fxml.FXMLLoader.access$100(FXMLLoader.java:103)
  at javafx.fxml.FXMLLoader$Element.processEventHandlerAttributes(FXMLLoader.java:610)
  at javafx.fxml.FXMLLoader$ValueElement.processEndElement(FXMLLoader.java:770)
  at javafx.fxml.FXMLLoader.processEndElement(FXMLLoader.java:2823)
  at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2532)
  at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441)
  at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2409)
  at guichat.HomeController.goToCreateGroup(HomeController.java:112)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:498)
  at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:71)
  at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:498)
  at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:275)
  at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1769)
  at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1657)
  at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
  at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
  at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
  at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
  at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
  at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
  at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
  at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
  at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
  at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
  at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
  at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
  at javafx.event.Event.fireEvent(Event.java:198)
  at javafx.scene.Node.fireEvent(Node.java:8413)
  at javafx.scene.control.Button.fire(Button.java:185)
  at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:182)
  at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:96)
  at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:89)
  at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
  at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
  at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
  at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
  at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
  at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
  at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
  at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
  at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
  at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
  at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
  at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
  at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
  at javafx.event.Event.fireEvent(Event.java:198)
  at javafx.scene.Scene$MouseHandler.process(Scene.java:3757)
  at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3485)
  at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762)
  at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2494)
  at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:394)
  at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
  at java.security.AccessController.doPrivileged(Native Method)
  at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$353(GlassViewEventHandler.java:432)
  at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
  at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:431)
  at com.sun.glass.ui.View.handleMouseEvent(View.java:555)
  at com.sun.glass.ui.View.notifyMouse(View.java:937)
  at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
  at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177)
  at java.lang.Thread.run(Thread.java:748)
  </code></pre>
  
  <p>I've been reading posts with this error but they did not work for me, I'm using Scene Builder to create the interface. Does anyone have an idea about why is this error?</p>