4

I have created a metadata schema which has a dropdown field referring to a particular catrgory. When I apply the metadata on page and publish the page, I get internal server error.

Error message:

2015-09-05 04:00:44,039 ERROR JSONSerializer - Error deserializing. com.fasterxml.jackson.databind.JsonMappingException: Can not construct instance of org.dd4t.contentmodel.Category, problem: abstract types either need to be mapped to concrete types, have custom deserializer, or be instantiated with additional type information at [Source: {"RevisionDate":"2015-09-05T13:00:27.693","Filename........ ..................................................................... .......................................................................... ; line: 1, column: 17721] (through reference chain: org.dd4t.contentmodel.impl.PageImpl["Categories"]->java.util.ArrayList[0])

When I apply similar metadata on Structure Group, the pages work fine.

I am passing the values of these metadata schemas to GenerateSitemap TBB. Do I need to use any special data-type for category and keywords? Currently I am using string and navigation.json is formed correctly.

We are using java DXA.

Update:

This issue also occurs on pages which do not have navigation. So I suspect its not related to sitempap TBB or navigation

1 Answer 1

5

This was a bug in the dd4t-2 beta stack. Since you are using (probably?) a mixed set of DXA-Java and a dd4t-2 stack, I'm not sure where it should be fixed.

In any case, the actual fix is in org.dd4t.contentmodel.PageImpl:

// change this line:

@JsonProperty("Categories")
private List categories;

// Into this line:

@JsonProperty("Categories") @JsonDeserialize(contentAs = CategoryImpl.class)
private List categories;
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.