title: javafx.fxml.LoadException occurs while loading FXML
body: <p>I am trying to create a very simple <code>VBox</code> with a black background. Thats all. Nothing else. I am using <code>FXML</code> to describe my <code>VBox</code>.  </p>
  
  <p>sample.fxml:  </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;?import javafx.scene.layout.VBox?&gt;
  
  &lt;VBox xmlns:fx="http://javafx.com/fxml" fx:controller="sample.Controller" alignment="CENTER" background="#000000ff"&gt;
  &lt;/VBox&gt;   
  </code></pre>
  
  <p>Controller.java:  </p>
  
  <pre><code>package sample;
  
  public class Controller {  
      // No code written. Not required.
  }  
  </code></pre>
  
  <p>Main.java:  </p>
  
  <pre><code>package sample;
  
  import javafx.application.Application;
  import javafx.fxml.FXMLLoader;
  import javafx.scene.Parent;
  import javafx.scene.Scene;
  import javafx.stage.Stage;
  
  
  /* Code auto generated by IDEA IDE. */
  public class Main extends Application {
  
      @Override
      public void start(Stage primaryStage) throws Exception{
          Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));
          primaryStage.setTitle("Adi's login app");
          primaryStage.setScene(new Scene(root, 300, 275));
          primaryStage.show();
      } 
  
  
      public static void main(String[] args) {
          launch(args);
      }
  }  
  </code></pre>
  
  <p>I am using <code>IDEA IntelliJ</code> IDE. And I am getting the following error:  </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>Exception in Application start method
  Exception in thread "main" java.lang.RuntimeException: Exception in Application start method
   at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)
   at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$152(LauncherImpl.java:182)
   at com.sun.javafx.application.LauncherImpl$$Lambda$2/51228289.run(Unknown Source)
   at java.lang.Thread.run(Thread.java:745)
  Caused by: javafx.fxml.LoadException: 
  /Users/aditya/Desktop/workspace/Java/LoginApp/out/production/LoginApp/sample/sample.fxml:5
  
   at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2605)
   at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2583)
   at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2445)
   at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3218)
   at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3179)
   at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3152)
   at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3128)
   at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3108)
   at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3101)
   at sample.Main.start(Main.java:13)
   at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$159(LauncherImpl.java:863)
   at com.sun.javafx.application.LauncherImpl$$Lambda$53/87719178.run(Unknown Source)
   at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$172(PlatformImpl.java:326)
   at com.sun.javafx.application.PlatformImpl$$Lambda$49/2001689116.run(Unknown Source)
   at com.sun.javafx.application.PlatformImpl.lambda$null$170(PlatformImpl.java:295)
   at com.sun.javafx.application.PlatformImpl$$Lambda$51/779320874.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at com.sun.javafx.application.PlatformImpl.lambda$runLater$171(PlatformImpl.java:294)
   at com.sun.javafx.application.PlatformImpl$$Lambda$50/1474675095.run(Unknown Source)
   at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
  Caused by: java.lang.IllegalArgumentException: Unable to coerce #000000ff to class javafx.scene.layout.Background.
   at com.sun.javafx.fxml.BeanAdapter.coerce(BeanAdapter.java:495)
   at com.sun.javafx.fxml.BeanAdapter.put(BeanAdapter.java:258)
   at com.sun.javafx.fxml.BeanAdapter.put(BeanAdapter.java:54)
   at javafx.fxml.FXMLLoader$Element.applyProperty(FXMLLoader.java:508)
   at javafx.fxml.FXMLLoader$Element.processValue(FXMLLoader.java:359)
   at javafx.fxml.FXMLLoader$Element.processPropertyAttribute(FXMLLoader.java:321)
   at javafx.fxml.FXMLLoader$Element.processInstancePropertyAttributes(FXMLLoader.java:231)
   at javafx.fxml.FXMLLoader$ValueElement.processEndElement(FXMLLoader.java:763)
   at javafx.fxml.FXMLLoader.processEndElement(FXMLLoader.java:2827)
   at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2536)
   ... 18 more</code></pre>
  </div>
  </div>
  </p>
  
  <p>Why is this happening? Please let me know if I am making any mistake or if I am missing out anything. </p>