I have an inheritance structure where SubtaskGroupA and SubtaskGroupB both inherit from the @MappedSuperclass Subtask and to allow the user to submit multiple Subtasks of one Group. I use a helper class SubtaskList with a field List subtasks. A form of this helper class is rendered, a user will enter information (using scala's @select-helper)into all subtasks and submit the form.
When binding the input using Form<SubtaskList> form = form(SubtaskList.class).bindFromRequest();
I receive the following exception:
Caused by: com.fasterxml.jackson.databind.JsonMappingException: No serializer found for class play.data.Form and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) ) (through reference chain: java.util.ArrayList[0]->models.qosdatamodel.SubtaskGroupA["form"])
at com.fasterxml.jackson.databind.ser.impl.UnknownSerializer.failForEmpty(UnknownSerializer.java:59) ~[jackson-databind-2.3.3.jar:2.3.3]
at com.fasterxml.jackson.databind.ser.impl.UnknownSerializer.serialize(UnknownSerializer.java:26) ~[jackson-databind-2.3.3.jar:2.3.3]
at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:541) ~[jackson-databind-2.3.3.jar:2.3.3]
at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:644) ~[jackson-databind-2.3.3.jar:2.3.3]
at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:152) ~[jackson-databind-2.3.3.jar:2.3.3]
All fields are private with public getters/setters. I get the same exception when calling toJson on a List of all SubtaskGroupA's.
All help is appreciated.
Edit: The @JsonIgnore Annotation helped a little, I guess, but now I receive a different exception on bindFromRequest():
Caused by: org.springframework.beans.NullValueInNestedPathException: Invalid property 'subtasks' of bean class [models.qosdatamodel.SubtaskList]: Could not instantiate property type [models.qosdatamodel.Subtask] to auto-grow nested property path: java.lang.InstantiationException
at org.springframework.beans.BeanWrapperImpl.newValue(BeanWrapperImpl.java:651) ~[spring-beans-4.0.3.RELEASE.jar:4.0.3.RELEASE]
at org.springframework.beans.BeanWrapperImpl.growCollectionIfNecessary(BeanWrapperImpl.java:885) ~[spring-beans-4.0.3.RELEASE.jar:4.0.3.RELEASE]
at org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:790) ~[spring-beans-4.0.3.RELEASE.jar:4.0.3.RELEASE]
at org.springframework.beans.BeanWrapperImpl.getNestedBeanWrapper(BeanWrapperImpl.java:571) ~[spring-beans-4.0.3.RELEASE.jar:4.0.3.RELEASE]
at org.springframework.beans.BeanWrapperImpl.getBeanWrapperForPropertyPath(BeanWrapperImpl.java:548) ~[spring-beans-4.0.3.RELEASE.jar:4.0.3.RELEASE]
`