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
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

Invalid recursion selector value issue in AEM 6.5

shajiahmed
Level 3
Level 3

we recently moved from 6.2 to 6.5, we converted felix to osgi. There are several servlets that is showing 400 with following message

Invalid recursion selector value 'abc'

Cannot serve request to /content/mysite/en-us/some/application/page/_jcr_content.abc.json in org.apache.sling.servlets.get.DefaultGetServlet

Here is my servlet class

@component(service = Servlet.class, property = {
SLING_SERVLET_RESOURCE_TYPES + "={/apps/xxx/components/structure/resourcetype, xxx/components/structure/resourcetype}",
SLING_SERVLET_METHODS + "=GET",
SLING_SERVLET_EXTENSIONS+"=json",
SLING_SERVLET_SELECTORS+"=abc"})
public class SampleServlet extends SlingSafeMethodsServlet {

http://localhost:4502/content/mysite/en-us/some/application/page/_jcr_content.abc.json
As per the following post form Ankur_Khare, I checked servlet status it is in active state
https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/invalid-recursion-selector...
I checked resolver map in system console, path is getting resolved and mapped, however I am still getting the
incursion selector error

@Ankur_Khare

1 Accepted Solution
markus_bulla_adobe
Correct answer by
Employee
Employee

Hi @shajiahmed!

 

Please verify that your request matches all requirements defined in your servlets component annotation:

  • It's a GET request (probably true)
  • It has the correct extension (json; looks good)
  • It has the correct selector (abc; looks good)
  • The resource at the requested path matches one of your listed resourceTypes - this could potentially be an issue.

I'm not sure about the resourceTypes listed in your example. Does your real world code also end with "/resourcetype"? Usually, these would look something like "weretail/components/structure/page". The actual naming is not important but they have to match between the "sling:resourceType" property in the content and the according definition in your servlet. So if your servlet registers for "xxx/components/structure/resourcetype" you should have the exact same string in the sling:resourceType property of /content/mysite/en-us/some/application/page/jcr:content.

 

You can double check on the resolution of your request in the Web Consoles Sling Servlet Resolver UI: http://localhost:4502/system/console/servletresolver to see how the request URL is decomposed (into selectors, extension, suffix) and what servlets are evaluated as candidates to handle the request. In addition to that you may also want to check what the Web Consoles Resource Resolver at http://localhost:4502/system/console/jcrresolver has to say about your request.

 

If things still don't work es expected, you may want to remove some of the restrictions for your servlets component registration (e. g. just register for the GET method and the "abc" selector) and see if that works. If it does, you can add the others properties one by one to see which one "breaks" the expected behavior.

 

Hope that helps!

View solution in original post

4 Replies
asutosh_jena
Community Advisor
Community Advisor

Hi @shajiahmed 

 

Please check if all the services that you are using in your servlet are resolving properly and all are in active state. All the services needs to be active.

 

Thanks!

shajiahmed
Level 3
Level 3

I already check as I mentioned in the post Ankur Khare's link, all of them active and resolving properly. 

markus_bulla_adobe
Correct answer by
Employee
Employee

Hi @shajiahmed!

 

Please verify that your request matches all requirements defined in your servlets component annotation:

  • It's a GET request (probably true)
  • It has the correct extension (json; looks good)
  • It has the correct selector (abc; looks good)
  • The resource at the requested path matches one of your listed resourceTypes - this could potentially be an issue.

I'm not sure about the resourceTypes listed in your example. Does your real world code also end with "/resourcetype"? Usually, these would look something like "weretail/components/structure/page". The actual naming is not important but they have to match between the "sling:resourceType" property in the content and the according definition in your servlet. So if your servlet registers for "xxx/components/structure/resourcetype" you should have the exact same string in the sling:resourceType property of /content/mysite/en-us/some/application/page/jcr:content.

 

You can double check on the resolution of your request in the Web Consoles Sling Servlet Resolver UI: http://localhost:4502/system/console/servletresolver to see how the request URL is decomposed (into selectors, extension, suffix) and what servlets are evaluated as candidates to handle the request. In addition to that you may also want to check what the Web Consoles Resource Resolver at http://localhost:4502/system/console/jcrresolver has to say about your request.

 

If things still don't work es expected, you may want to remove some of the restrictions for your servlets component registration (e. g. just register for the GET method and the "abc" selector) and see if that works. If it does, you can add the others properties one by one to see which one "breaks" the expected behavior.

 

Hope that helps!

View solution in original post

Arun_Patidar
Community Advisor
Community Advisor

Hi,

Just update the below line in your code. if you want to use multiple resourcetype then use multiple lines

SLING_SERVLET_RESOURCE_TYPES + "=xxx/components/structure/resourcetype",