title: JavaFX IllegalAccessException during FXML load()
body: <p>I have a dialog window that is invoked by the following code (<code>DialogController</code> is a helper class for using modal dialog windows; it mainly bundles together a controller reference with its window):</p>
  
  <pre><code>void handleServicesEdit(ActionEvent event) throws IOException {
  
      DCServRecEditor sre = DialogController.&lt;DCServRecEditor&gt;loadFXML(
              CensusAssistant.RES_FXML_DIALOG_SERVEDIT,
              CensusAssistant.RES_STRING_SERVEDIT,
              this.getDialog());
      sre.setDialogMode(DB.DBEDIT_MODE_EDIT,
                        tbvService.getItems(),
                        tbvService.getSelectionModel().getSelectedIndex(),
                        m_encCal);
      sre.showAndWait();
  
      sre.release();
      this.updateGUI();
  }
  </code></pre>
  
  <p>I have confirmed that I get an exception during the <code>FXMLLoader.load()</code> method.  I have also determined that the error occurs before any code in my <code>initialize()</code> method has a chance to run.  Some of the stack trace that I get from <code>load()</code> is here:</p>
  
  <pre><code>java.lang.IllegalAccessException: Class sun.reflect.misc.ReflectUtil 
      can not access a member of class org.kls.md.censusassistant.DCServRecEditor 
      with modifiers ""
  file:/D:/Documents/NetBeansProjects/CensusAssistant/dist/run1284250063/CensusAssistant.jar!/org/kls/md/censusassistant/fxml/GUIServRecEditor.fxml:13
    at javafx.fxml.FXMLLoader$ValueElement.processAttribute(FXMLLoader.java:738)
    at javafx.fxml.FXMLLoader$InstanceDeclarationElement.processAttribute(FXMLLoader.java:775)
    at javafx.fxml.FXMLLoader$Element.processStartElement(FXMLLoader.java:180)
    at javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:563)
      at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2314)
    at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2131)
    at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2028)
    at org.kls.md.censusassistant.DialogController.loadFXML(DialogController.java:63)
    at org.kls.md.censusassistant.DCMainEditor.handleServicesEdit(DCMainEditor.java:330)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  
          ...
  
  Caused by: java.lang.IllegalAccessException: Class sun.reflect.misc.ReflectUtil
      can not access a member of class org.kls.md.censusassistant.DCServRecEditor
      with modifiers "" 
    at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:95)
    at java.lang.Class.newInstance0(Class.java:368)
    at java.lang.Class.newInstance(Class.java:327)
    at sun.reflect.misc.ReflectUtil.newInstance(ReflectUtil.java:46)
    at javafx.fxml.FXMLLoader$ValueElement.processAttribute(FXMLLoader.java:731)
  ... 66 more
  </code></pre>
  
  <p>My class <code>DCServRecEditor</code> is a subclass of <code>DialogController</code>.  It is a pretty normal looking FXML controller class:</p>
  
  <pre><code>class DCServRecEditor extends DialogController {
  
      private int m_dialogMode = DB.DBEDIT_MODE_ADD;
      private int m_selServ = -1;
      private GregorianCalendar m_cal = null;
  
  
      @FXML // ResourceBundle that was given to the FXMLLoader
      private ResourceBundle resources;
  
      @FXML // URL location of the FXML file that was given to the FXMLLoader
      private URL location;
  
      @FXML // fx:id="ancMatchSelector"
      private AnchorPane ancMatchSelector; // Value injected by FXMLLoader
  
      @FXML // fx:id="ancServEditor"
      private AnchorPane ancServEditor; // Value injected by FXMLLoader
  
      @FXML // fx:id="ancServRecEditor"
      private AnchorPane ancServRecEditor; // Value injected by FXMLLoader
  
          ...
  }
  </code></pre>
  
  <p>I have double and triple checked to make sure that there wasn't a named control in the FXML that didn't also have an instance field in the controller class.
  All the instance fields are tagged with <code>@FXML</code>. </p>
  
  <p>The name of the controller class in the FXML is the same as my java file and is properly qualified.
  The error occurs before <code>initialize()</code> is called, so I don't think it's anything with <code>initialize()</code>, although I have checked to make sure it is also tagged with <code>@FXML</code>.</p>
  
  <p>The skeleton for my controller class was copied and pasted from <em>Scene Builder</em> ... I've gone back and repasted blocks of stuff from <em>Scene Builder</em> to be sure that there wasn't a control I was missing in my java file.</p>
  
  <p>The error message gives me no specifics about the member it is having its problem with, other than to say it has modifiers "".
  I went back to my controller class and made all the members with default access <code>public</code>, and I still get the error.<br>
  I don't even know where in my class the problem is coming from.
  Anyone have any ideas about what is going wrong here?</p>