This problem can be caused by incorrect path to the FXML file.
If you're using absolute paths (my/package/views/view.fxml
), you have to precede then with a slash:
getClass().getResource("/my/package/views/view.fxml")
You can use relative paths as well:
getClass().getResource("views/view.fxml")