Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

REST endpoint not working after AEM Forms 6.5.16 Add-on upgrade


Level 2

Hello all, I would like to share a finding about the latest AEM Forms 6.5.16 Add-ons in hope that it would help those who experienced the same issue as well as an explanation as to what's happening.


In our server environment using AEM 6.5.15 + AEM Forms 6.5.15 with JDK, after upgrade to AEM 6.5.16 SP + AEM Forms 6.5.16 Add-ons + JDK 11.0.18, the out-of-the-box REST endpoint submission type starting to fail with following error in the log even when the upgrades were clean and successful:

com.adobe.aemds.guide.utils.GuideSubmitUtils.getRedirectParameters(Lorg/apache/sling/api/SlingHttpServletRequest;)Ljava/util/Map; at org.apache.jsp.libs.fd.af.components.guidesubmittype.restendpoint.post_POST_jsp._jspService(post_POST_jsp.java:373) at org.apache.sling.scripting.jsp.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) [org.apache.sling.scripting.jsp:2.3.6] at javax.servlet.http.HttpServlet.service(HttpServlet.java:764) [org.apache.felix.http.servlet-api:1.2.0]​

After digging deeper, the latest com.adobe.aemds.guide.aemds-guide-core-6.0.528.jar has changed the signature of GuideSubmitUtils.getRedirectParameters() from 

public static Map<String, String> getRedirectParameters(SlingHttpServletRequest request) {/*...*/}​


public static Map<String, String> getRedirectParameters(HttpServletRequest request) {/*...*/}​

When the error occurred, the fix found was to use explicit casting in line #65 of /libs/fd/af/components/guidesubmittype/restendpoint/post.POST.jsp as following: 

redirectParameters = GuideSubmitUtils.getRedirectParameters((HttpServletRequest)slingRequest);​

What's odd was that after the JSP was recompiled, the explicit casting was no longer needed and can be restored back to the original (without casting). 


It is still puzzling as to why the explicit casting is needed in order to make the previously compiled JSP in JDK + AEM 6.5.15 SP to work.  The speculations are:

1.  SlingHttpServletRequest API is an interface implementing multiple superclasses which may sometimes cause JDK 11 to confuse in auto-cross casting?

2.  JDK binary codes has cross casting compatibility issue with JDK 11.0.18 or JDK 1.8_u321 used to build com.adobe.aemds.guide.aemds-guide-core-6.0.528.jar


With the odd experience, it may be worth it to ensure explicit casting (HttpServletRequest) is used whenever calling GuideSubmitUtils.getRedirectParameters() in JSP or OSGi services.  

0 Replies