0

SubtaskGroupA と SubtaskGroupB の両方が @MappedSuperclass サブタスクから継承し、ユーザーが 1 つのグループの複数のサブタスクを送信できるようにする継承構造があります。フィールド List subtasks を持つヘルパー クラス SubtaskList を使用します。このヘルパー クラスのフォームがレンダリングされ、ユーザーは (scala の @select-helper を使用して) すべてのサブタスクに情報を入力し、フォームを送信します。を使用して入力をバインドするForm<SubtaskList> form = form(SubtaskList.class).bindFromRequest();と、次の例外が発生します。

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]

すべてのフィールドはパブリックのゲッター/セッターでプライベートです。すべての SubtaskGroupA のリストで toJson を呼び出すと、同じ例外が発生します。

すべての助けに感謝します。

編集: @JsonIgnore アノテーションは少し役に立ったと思いますが、今は 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]

`

4

1 に答える 1

0

I think the problem exists in your model models.qosdatamodel.SubtaskGroupA. You cannot get access to some field from this class. To avoid this problem you have to find which field caused the problem (you'll find it in logs) and add annotation @JsonIgnore

I don't know exactly if above class SubtaskGroupA is the right one but I'm definitely sure that this is the problem.

Probably you're trying to make json from you model class and error comes from one of your relationships :)

Edit SubtaskList - in this class probably you have a problem :)

于 2015-04-22T12:21:06.727 に答える