Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Jackson mapper infinite incursion with sling models

Avatar

Level 3
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  {

@Self

private Resource resource;

1 Reply

Avatar

Level 3

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