title: InvocationTargetException when trying to assign items to choicebox using javafx
body: <p>The simple attempt to add choices to my choice box results in a <code>InvocationTargetException</code>. I don't really understand the reason of why this exception is thrown, so a explanation along with a soloution would be great! Here is my code in the FXMLDocumentController Class:</p>
  
  <pre><code>public class FXMLDocumentController implements Initializable {
  
      @FXML
      private ChoiceBox&lt;?&gt; pilot;
  
      public FXMLDocumentController(){  
  
           setMembersList();
      }
  
  
      private void setMembersList(){
          List&lt;String&gt; list = new ArrayList&lt;String&gt;();
          list.add("Item A");
          list.add("Item B");
          list.add("Item C");
          ObservableList obList = FXCollections.observableList(list);
          pilot.setItems(obList);
      }
  }
  </code></pre>
  
  <p>Here is what I get...:</p>
  
  <pre><code>Exception in Application start method
  
  java.lang.reflect.InvocationTargetException
  
      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:483)
      at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:367)
      at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:305)
      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:483)
      at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
  Caused by: java.lang.RuntimeException: Exception in Application start method
      at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:894)
      at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:56)
      at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:158)
      at java.lang.Thread.run(Thread.java:745)
  </code></pre>
  
  <p>Using trial and error the exception is definitely thrown in the line <code>pilot.setItems(obList);</code> as it starts up without any exceptions when I get rid of this line. </p>