Invalid recursion selector value issue in AEM 6.5 | Community
Skip to main content
May 6, 2021
Solved

Invalid recursion selector value issue in AEM 6.5

  • May 6, 2021
  • 4 replies
  • 9260 views

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

@8220494(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-value-metadata-schema/qaq-p/318756
I checked resolver map in system console, path is getting resolved and mapped, however I am still getting the
incursion selector error

@ankur_khare

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 MarkusBullaAdobe

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!

4 replies

Asutosh_Jena_
Community Advisor
Community Advisor
May 7, 2021

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!

May 7, 2021

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

MarkusBullaAdobe
Adobe Employee
MarkusBullaAdobeAdobe EmployeeAccepted solution
Adobe Employee
May 7, 2021

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!

arunpatidar
Community Advisor
Community Advisor
May 8, 2021

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", 

Arun Patidar
Uppari_Ramesh
February 28, 2023

I faced same issue and this is because of Unsatisfied references in the service which I called from my servlet. So go to http://localhost:4502/system/console/components and verify your servlet/service if all the references are satisfied or not. If not satisfied you will get this error.