Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Invalid recursion selector value issue in AEM 6.5

Avatar

Level 4

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

Avatar

Correct answer by
Employee Advisor

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

5 Replies

Avatar

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!

Avatar

Level 4

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

Avatar

Correct answer by
Employee Advisor

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!

Avatar

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



Arun Patidar

Avatar

Level 4

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.