title: NullPointerException load fxml
body: <p>I want to load an fxml file in my application. I use the next code:</p>
  
  <pre><code>try {
     FXMLLoader loader = new FXMLLoader();
     loader.setController(null);
     loader.setRoot(null);
     loader.setResources(ResourceBundle.getBundle(BUNDLE));
     Node root = null;
     root = (Node) loader.load(JfxUtils.class.getResource(fxml).openStream());
     return root;
  } catch (IOException e) {
     throw new IllegalStateException("cannot load FXML screen", e);
  }
  </code></pre>
  
  <p>With some fxml, all work fine, with others I get this exception:</p>
  
  <pre><code>Caused by: java.lang.NullPointerException
      at javafx.fxml.FXMLLoader.equals(FXMLLoader.java:1856)
      at javafx.fxml.FXMLLoader.isCyclic(FXMLLoader.java:1868)
      at javafx.fxml.FXMLLoader.access$2100(FXMLLoader.java:71)
      at javafx.fxml.FXMLLoader$IncludeElement.constructValue(FXMLLoader.java:941)
      at javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:570)
      at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2356)
      at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2172)
  </code></pre>
  
  <p>I don't understand why I get this exception.</p>
  
  <p>Thanks.</p>
  
  <p><strong>EDIT:</strong> Add include exemple:</p>
  
  <p>My parent fxml</p>
  
  <pre><code>&lt;fx:root type="javafx.scene.layout.AnchorPane" fx:id="scrollPane" id="scrollStocksList"
      xmlns:fx="http://javafx.com/fxml"
      fx:controller="net.StocksListRunningController"&gt;
      &lt;fx:include fx:id="tableListStock"
          source="/fxml/stocksList.fxml" /&gt;
  &lt;/fx:root&gt;
  </code></pre>
  
  <p>My include file:</p>
  
  <pre><code>&lt;fx:root type="javafx.scene.layout.VBox" xmlns:fx="http://javafx.com/fxml"
      fx:controller="net.StockListTableController"&gt;
      &lt;TableView fx:id="stocksList" onMouseClicked="#openDetail"&gt;
          &lt;columns&gt;
              &lt;TableColumn text="Titre" prefWidth="125"&gt;
                  &lt;cellValueFactory&gt;
                      &lt;PropertyValueFactory property="title" /&gt;
                  &lt;/cellValueFactory&gt;
              &lt;/TableColumn&gt;
              &lt;TableColumn text="Quantité" prefWidth="75" fx:id="quantityColumn"&gt;
                  &lt;cellValueFactory&gt;
                      &lt;PropertyValueFactory property="quantity" /&gt;
                  &lt;/cellValueFactory&gt;
              &lt;/TableColumn&gt;
              &lt;TableColumn text="Prix unitaire" prefWidth="100"&gt;
                  &lt;cellValueFactory&gt;
                      &lt;PropertyValueFactory property="unitPrice" /&gt;
                  &lt;/cellValueFactory&gt;
              &lt;/TableColumn&gt;
              &lt;TableColumn text="Prix total" prefWidth="120"&gt;
                  &lt;cellValueFactory&gt;
                      &lt;PropertyValueFactory property="price" /&gt;
                  &lt;/cellValueFactory&gt;
              &lt;/TableColumn&gt;
              &lt;TableColumn text="Sens" prefWidth="50"&gt;
                  &lt;cellValueFactory&gt;
                      &lt;PropertyValueFactory property="direction" /&gt;
                  &lt;/cellValueFactory&gt;
              &lt;/TableColumn&gt;
              &lt;TableColumn text="Date d'achat" prefWidth="100"&gt;
                  &lt;cellValueFactory&gt;
                      &lt;PropertyValueFactory property="date" /&gt;
                  &lt;/cellValueFactory&gt;
              &lt;/TableColumn&gt;
              &lt;TableColumn text="Jours écoulés" prefWidth="100"&gt;
                  &lt;cellValueFactory&gt;
                      &lt;PropertyValueFactory property="dayRunning" /&gt;
                  &lt;/cellValueFactory&gt;
              &lt;/TableColumn&gt;
          &lt;/columns&gt;
      &lt;/TableView&gt;
  &lt;/fx:root&gt;
  </code></pre>