Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

Jackson mapper infinite incursion with sling models

Avatar

Level 4
when converting sling models to jackson mapper I am getting  java.lang.IllegalArgumentException: Infinite recursion (StackOverflowError) (through reference chain: ehi.author.ext.aem65.reporting.impl.reports.models.ReportPage["resource"]
 

ReportPage page = (ReportPage) report;

Map<String, Object> reportPagePropMap = objectMapper.convertValue(page, // failing here

new TypeReference<Map<String, Object>>() { 

});

Where ReportPage is a slingModel defined as 

@Model(adaptables=org.apache.sling.api.resource.Resource.class,defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL)

public class ReportPage  {

@Deleted Account

private Resource resource;

1 Reply

Avatar

Level 5

Can you provide more info exactly you want to do in the model class?

 

Sample Code or Logic that you want to achieve?

 

Thanks,

Veena K