Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.

Jackson mapper infinite incursion with sling models


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


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?



Veena K