Hi,
I created a sample AEM Forms project using archetype 54 and core components dependency.
I am submitting form data to locally deployed servlet using 'Submit to Rest Endpoint' option.
The form submission is failing with internal server error and I can see the exception like below in the log(I added separate logger for 'com.adobe' and 'org.sling'). From the exception, it looks like issue with Model class initialization.
adobe-aemfd-win-pkg-6.0.1328.zip |
Views
Replies
Total Likes
Hi @sarikajain,
I’ve analyzed the error logs from the failed AEM Forms submission. The failure occurs because the Sling Models used by the Forms Core Components expect a SlingHttpServletRequest
, but the runtime is attempting to adapt from a JcrNodeResource
. Since JcrNodeResource
cannot be adapted to SlingHttpServletRequest
, the model initialization fails and causes the internal server error.
Key technical points:
Forms Core Components dependency
Confirm that the version of com.adobe.aem.core-forms-components-af-core
(currently 1.1.66
per logs) matches your AEM SDK version. Version mismatches can lead to adaptation issues.
Custom component inheritance
Ensure all components under /apps/myform/components/adaptiveForm/...
declare the correct sling:resourceSuperType
.
For example:
<sling:resourceSuperType="fd/af/components/guideTextBox"/>
Without the proper supertype, AEM will adapt directly from a node resource, bypassing the request binding.
Model adaptation in code
When instantiating models, use: request.adaptTo(MyModel.class); instead of adapting from the resource: resource.adaptTo(MyModel.class);
This ensures the request context is available for injection.
Servlet registration
Verify that your servlet handling the form submission is correctly mapped using @SlingServletPaths
or @SlingServletResourceTypes
.
If the servlet is not matched, AEM will route to the default AdaptiveFormSubmitServlet
, which traverses component models and triggers the adaptation error.
Next steps:
Align the Forms Core Components dependency with your SDK version.
Update custom components to inherit from the appropriate OOTB Forms Core Components.
Review servlet mappings to ensure the request is routed to your custom servlet.
This should resolve the Sling Model initialization errors and enable successful submissions.
Thanks
Views
Replies
Total Likes
Thanks for prompt reply Pranay.
Please find below check outcomes -
1. Forms Core Components dependency -
Forms SDK version 6.0.1328
Core Components version 1.1.66
matches as per core component documentation
2. No custom component. Only proxying core components.
3. No model extension or adaptation in code.
4. Servlet registration is working.
Please confirm if you need any other information.
Views
Replies
Total Likes
Site is not letting me add templates and sample forms. I was using the OOTB templates that are generated from archetype project.
Archetype version is 45 not 54 as mentioned earlier.
mvn -B org.apache.maven.plugins:maven-archetype-plugin:3.2.1:generate -D archetypeGroupId=com.adobe.aem -D archetypeArtifactId=aem-project-archetype -D archetypeVersion=45 -D appTitle="My Form" -D appId="myform" -D groupId="com.myform" -D includeFormsenrollment="y" -D aemVersion="6.5.22"
It is a simple form with one form fragment containing two input fields.
Views
Replies
Total Likes
Views
Like
Replies