Exception while calling a Servlet | Community
Skip to main content
New Participant
October 16, 2015
Solved

Exception while calling a Servlet

  • October 16, 2015
  • 3 replies
  • 6205 views

Hello,

I am trying to access a servlet with a doPost method from the jsp and getting the following exception -

Caused by: org.apache.sling.api.resource.PersistenceException: Resource at '/location/Stores' is not modifiable.
    at org.apache.sling.servlets.post.impl.helper.SlingPropertyValueHandler.setProperty(SlingPropertyValueHandler.java:153)
    at org.apache.sling.servlets.post.impl.operations.ModifyOperation.writeContent(ModifyOperation.java:411)
    at org.apache.sling.servlets.post.impl.operations.ModifyOperation.doRun(ModifyOperation.java:101)

 

My bundle is built successfully and the resource resolver shows the path as expected and resolves to the given path.

Activate method of the servlet is successfully called.However while trying to give an Ajax call from the jsp it never reaches the doPost method.I tried it both with doPost and doGet.Please help.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Lokesh_Shivalingaiah

give your servlet path as /bin/location/Stores or /services/location/Stores which is configured in 'Apache Sling Servlet Resolver'

If you want, you can add your own Servlet/Script resolver from /system/console/configMgr and your custom resourcePath will be resolved by the servlet resolver

3 replies

edubey
New Participant
October 16, 2015

AEM is thinking that request /location/Stores is a resource path, he is unable to think this as request for your servlet, then it tries to alter this path , and fails as it does not exist.

Ensure that your servlet is active or not under /system/console/components.

See this community article as well to check what you are missing: https://helpx.adobe.com/experience-manager/using/custom-sling-servlets.html

Would you mind sharing code snippet of your servlet please?

Lokesh_Shivalingaiah
Lokesh_ShivalingaiahAccepted solution
New Participant
October 16, 2015

give your servlet path as /bin/location/Stores or /services/location/Stores which is configured in 'Apache Sling Servlet Resolver'

If you want, you can add your own Servlet/Script resolver from /system/console/configMgr and your custom resourcePath will be resolved by the servlet resolver

New Participant
October 16, 2015

Thanks!! This was really helpful.I tried a customized and did not include anything from the 'Apache Sling Servlet Resolver' which was causing this issue.Thanks a ton!! :) :)