[Solved] How do I fix NullPointerException and putting data into NatTable


Your problem is that you have nested objects and you want to access them via reflection. That is not working!

If your Student would only have one exam, you would need to change the propertyNames to this:

String[] propertyNames = { "name", "groupNumber", "exam.name", "exam.mark" };

and the definition of the data provider to this:

IDataProvider bodyDataProvider =
            new ListDataProvider<>(
                    students,
                    new ExtendedReflectiveColumnPropertyAccessor<Student>(propertyNames));

But your Student class has an array of Exam objects. How do you want to visualize such a tree structure in a table? NatTable is able to do this, but then you need some more things like the TreeLayer etc. And that in turn does not work with your data structure.

I would suggest to first think about what you want to visualize, then check which control fits your needs (is it a table or a tree?), and then check for some tutorials that definitely exist, like the NatTable Getting Started Tutorial or the JFace Table tutorial or the JFace Tree tutorial

solved How do I fix NullPointerException and putting data into NatTable