Error: org.apache.sling.api.request.TooManyCallsException in Custom Console

The article describes how to resolve the AEMaaCS issue where the org.apache.sling.api.request.TooManyCallsException error appears in the Custom Console. You can either overlay the path – …/aem/apps/lv/console/lvjobs/content/lvjobs.html OR set the limit globally by using the property 'sling.max.record.requests' on the OSGi configuration PID org.apache.sling.engine.impl.SlingMainServlet.

Description description

Environment

Adobe Experience Manager as a Cloud Service (AEMaaCS)

Issue/Symptoms

Custom Console throws the following Exception error message:

08.01.2024 08:59:17.846 [ cm-p56375-e520394-aem-author-5bbb4587bb-lmmkr]  *ERROR* [ 165.225.20.221 [ 1704704355708]  GET /apps/lv/console/lvjobs/content/lvjobs.html HTTP/1.1]  org.apache.sling.engine.impl.SlingRequestProcessorImpl service: Uncaught SlingException
    org.apache.sling.api.request.TooManyCallsException: BundledScriptServlet (/libs/granite/async/components/asyncjobs/jobitem/columns/progress/progress.jsp)
    at org.apache.sling.engine.impl.request.RequestData.service(RequestData.java:529) [ org.apache.sling.engine:2.15.6]
    at org.apache.sling.engine.impl.filter.SlingComponentFilterChain.render(SlingComponentFilterChain.java:45) [ org.apache.sling.engine:2.15.6]
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:88) [ org.apache.sling.engine:2.15.6]
    at com.day.cq.wcm.core.impl.WCMDeveloperModeFilter.doFilter(WCMDeveloperModeFilter.java:119) [ com.day.cq.wcm.cq-wcm-core:5.14.126]
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:78) [ org.apache.sling.engine:2.15.6]
    ...

    at java.base/java.lang.Thread.run(Thread.java:834)

Resolution resolution

There are two ways to resolve this error:

  1. Overlay the path > ../aem/apps/lv/console/lvjobs/content/lvjobs.html
    Add the following line early in the file >
    request.setAttribute("sling.max.calls", 10000); //Limited, or
    request.setAttribute("sling.max.calls", -1); //Unlimited
    OR
  2. Set the limit globally by using the property 'sling.max.record.requests' on the OSGi configuration PID org.apache.sling.engine.impl.SlingMainServlet (see ‘config.png’ attached).

As best practice, the overlay is a better route because it has a smaller blast radius, however both would work.

recommendation-more-help
3d58f420-19b5-47a0-a122-5c9dab55ec7f