title: JavaFX cannot retrieve property in PropertyValueFactory even though correct varProperty() methods are set
body: <p><strong>Summary:</strong></p>
  <p>I am trying to populate a TableView with an ObservableList that contains objects of class &quot;Contact&quot; that have fields of type SimpleStringProperty.</p>
  <p>Unfortunately it doesn't work. I get the error:</p>
  <pre><code>WARNING: Can not retrieve property 'firstName' in PropertyValueFactory: javafx.scene.control.cell.PropertyValueFactory@61e63bbc with provided class type: class sample.Datamodel.Contact
  java.lang.RuntimeException: java.lang.IllegalAccessException: module javafx.base cannot access class sample.Datamodel.Contact (in module JavaFXChallengeContactList) because
  at javafx.base/com.sun.javafx.property.PropertyReference.getProperty(PropertyReference.java:199)
  at javafx.controls/javafx.scene.control.cell.PropertyValueFactory.getCellDataReflectively(PropertyValueFactory.java:182)
  ... and many more
  </code></pre>
  <p>I did extensive research on this topic. In many cases other people have not implemented the variableProperty() method in the class. But it is there.</p>
  <p>I have made a method to create the columns, but other attempts (without it and putting the code directly in the initialize() method) also didn't work.</p>
  <p>When I run the code, I get the table with the headers, but no data.</p>
  <p>What is wrong here?</p>
  <p>Thank you very much for your support!</p>
  <p><strong>Code in Contact Class:</strong></p>
  <pre><code>public class Contact {
  
  private SimpleStringProperty firstName;
  private SimpleStringProperty lastName;
  private SimpleStringProperty phoneNumber;
  private SimpleStringProperty notes;
  
  public Contact(SimpleStringProperty firstName, SimpleStringProperty lastName, SimpleStringProperty phoneNumber, SimpleStringProperty notes) {
      this.firstName = firstName;
      this.lastName = lastName;
      this.phoneNumber = phoneNumber;
      this.notes = notes;
  }
  
  public String getFirstName() {
      return firstName.get();
  }
  
  public SimpleStringProperty firstNameProperty() {
      return firstName;
  }
  
  public void setFirstName(String firstName) {
      this.firstName.set(firstName);
  }
  
  ... (other methods for lastName, phoneNumer and notes are identical)
  </code></pre>
  <p><strong>Code in ContactData Class:</strong></p>
  <pre><code>public class ContactData {
  
  private ObservableList&lt;Contact&gt; contacts;
  
  public ContactData() {
      this.contacts = FXCollections.observableArrayList();
  }
  
  public void addContact(String fName, String lName, String phone, String notes) {
      SimpleStringProperty firstName = new SimpleStringProperty(fName);
      SimpleStringProperty lastName = new SimpleStringProperty(lName);
      SimpleStringProperty phoneNumber = new SimpleStringProperty(phone);
      SimpleStringProperty yourNotes = new SimpleStringProperty(notes);
      this.contacts.add(new Contact(firstName, lastName, phoneNumber, yourNotes));
  
  }
  
  public ObservableList&lt;Contact&gt; getContacts() {
      return contacts;
  }
  </code></pre>
  <p><strong>Code in Controller:</strong></p>
  <pre><code>public class Controller {
  
  @FXML
  private TableView table;
  
  public void initialize() {
      ContactData contactDatabase = new ContactData();
      contactDatabase.addContact(&quot;John&quot;, &quot;Doe&quot;, &quot;123&quot;, &quot;Hi John&quot;);
      contactDatabase.addContact(&quot;Peter&quot;, &quot;Mustang&quot;, &quot;321&quot;, &quot;Hello Pete&quot;);
      contactDatabase.addContact(&quot;Carl&quot;, &quot;Mueller&quot;, &quot;555&quot;, &quot;Hey Carl&quot;);
  
  
      TableColumn firstCol = setUpColumn(&quot;First Name&quot;,&quot;firstName&quot;);
      TableColumn secondCol = setUpColumn(&quot;Last Name&quot;,&quot;lastName&quot;);
      TableColumn thirdCol = setUpColumn(&quot;Phone Number&quot;,&quot;phoneNumber&quot;);
      TableColumn lastCol = setUpColumn(&quot;Your Notes&quot;,&quot;notes&quot;);
  
      table.setItems(contactDatabase.getContacts());
      table.getColumns().addAll(firstCol, secondCol, thirdCol, lastCol);
  
  }
  
  public TableColumn setUpColumn(String columnName, String idInContact) {
      TableColumn&lt;Contact, SimpleStringProperty&gt; column = new TableColumn&lt;&gt;(columnName);
      column.setCellValueFactory(new PropertyValueFactory&lt;&gt;(idInContact));
      return column;
  }
  </code></pre>