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

Invalid recursion selector value 'model'

Avatar

Avatar
Validate 1
Level 1
shyamasundar-ks
Level 1

Likes

0 likes

Total Posts

2 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
shyamasundar-ks
Level 1

Likes

0 likes

Total Posts

2 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
shyamasundar-ks
Level 1

10-06-2021

Invalid recursion selector value 'model'

Cannot serve request to /content/demo/us/en/home/jcr:content/root/responsivegrid/testrender.model.json in org.apache.sling.servlets.get.DefaultGetServlet.

FYI:

AEM 6.5

ui.frontendmodule="angular"

I am working on an AEM spa project using angular as the frontend module.

I am facing the above problem for each component, AEM dialog values are not reflecting on the save of the dialog, if we are observing in the browser network it's giving the above model error. Only on a refresh of the page values are displaying on the screen.

Please help me to resolve this problem.

Requirement:

I have to create almost 80 custom components in our project, If I started to write a model class for each component then I will end up creating 80 model classes I cannot write 80 model classes to make reflect on the save of each component.

Please suggest to me how to resolve this problem !!

Note:

I am using JSON editor in my AEM component to store data as JSON and read data directly into the Angular component to bypass the slingModel. (No need for Sling Model in this case)

Awaiting your response.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Boost 5
Level 5
Ritesh_M
Level 5

Likes

74 likes

Total Posts

67 posts

Correct Reply

19 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Applaud 5
Affirm 1
View profile

Avatar
Boost 5
Level 5
Ritesh_M
Level 5

Likes

74 likes

Total Posts

67 posts

Correct Reply

19 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Applaud 5
Affirm 1
View profile
Ritesh_M
Level 5

10-06-2021

Hi @shyamasundar-ks ,

 

As per my understanding you need to create the Sling Model and do the following-

 

1. Implement the ComponentExporter interface from your class.

2. Define getExportedType() method in Sling Model and return resource type from the above method.

3. inside Model annotation parameters

       a. Change adapter to SlingHtttpservletRequest.class from Resource.class 

       b. adapter = ComponentExporter.class

        c. resource = <RESOURCE-TYPE-COMPONENT>

4. Add Exporter annotation with extension as 'model' and name as "jackson"

 

You can find sample code here - https://github.com/riteshmittal/spa-code

 

Answers (1)

Answers (1)

Avatar

Avatar
Boost 500
MVP
Vijayalakshmi_S
MVP

Likes

500 likes

Total Posts

637 posts

Correct Reply

211 solutions
Top badges earned
Boost 500
Give Back 50
Give Back 5
Ignite 10
Ignite 5
View profile

Avatar
Boost 500
MVP
Vijayalakshmi_S
MVP

Likes

500 likes

Total Posts

637 posts

Correct Reply

211 solutions
Top badges earned
Boost 500
Give Back 50
Give Back 5
Ignite 10
Ignite 5
View profile
Vijayalakshmi_S
MVP

10-06-2021

Hi @shyamasundar-ks,

Please note that the selector "model" in the JSON path is because of the selector of @Exporter annotation(org.apache.sling.models.annotations.Exporter)whose default value is model  (to expose the component data/Sling Model using that selector) 

Vijayalakshmi_S_0-1623333461823.png

 

Now that you are not using Sling model/Exporter + accessing the path using model selector, you are getting "Invalid recursion selector value model"

Recommendation is to use Sling Model with Exporter framework to expose component data. If you are following alternate means, use the respective JSON path as is to read from Frontend.