Cleaning up of Orphan Pages/Nodes

Avatar

Avatar
Validate 1
Level 1
teamu33465496
Level 1

Likes

0 likes

Total Posts

12 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
teamu33465496
Level 1

Likes

0 likes

Total Posts

12 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile
teamu33465496
Level 1

11-02-2019

We have lot of below errors in our environment which are basically Orphan Nodes. Is there a way to clean up all the Orphan Nodes in our environment(not manually)?

We can write a script for that but I am not sure How to find all the orphan Nodes, do we have any similar property for identifying them?

No renderer for extension html, cannot render resource JcrNodeResource, type=nt:unstructured, superType=null, path=/content/envNode/www/en-us/banner-repository/banners/jcr:content/root/responsivegrid/custom_wrapper_58983/par/banner_container_cop_1825745486/par/par_copy/responsivegrid/spacer_copy_9611926

org.apache.sling.servlets.get.impl.DefaultGetServlet

Replies

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,409 likes

Total Posts

12,671 posts

Correct reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,409 likes

Total Posts

12,671 posts

Correct reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

11-02-2019

See this AEM Docs topic - it will help you -- Revision Cleanup

Avatar

Avatar
Validate 1
Level 1
teamu33465496
Level 1

Likes

0 likes

Total Posts

12 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
teamu33465496
Level 1

Likes

0 likes

Total Posts

12 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile
teamu33465496
Level 1

11-02-2019

Hey Donald,

We have been doing the online revision clean up but we still have the nodes which were orphan.

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,409 likes

Total Posts

12,671 posts

Correct reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,409 likes

Total Posts

12,671 posts

Correct reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

11-02-2019

I checked with customer support - they have replied:

They need to create a groovy script with some logic that they can use to run and delete it

Avatar

Avatar
Validate 1
Level 1
teamu33465496
Level 1

Likes

0 likes

Total Posts

12 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
teamu33465496
Level 1

Likes

0 likes

Total Posts

12 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile
teamu33465496
Level 1

11-02-2019

Is there a way that I can get the logic?

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,409 likes

Total Posts

12,671 posts

Correct reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,409 likes

Total Posts

12,671 posts

Correct reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

11-02-2019

Team replied:

The script needs to have a logic to fin nodes that they are considering as orphan.

Like it’s orphan because of a location, or name or type of node…

There are a lot of sample on the net. For example: https://hashimkhan.in/aem-adobecq5-code-templates/groovy-script/

Avatar

Avatar
Coach
Employee
Jörg_Hoh
Employee

Likes

1,134 likes

Total Posts

3,161 posts

Correct reply

1,079 solutions
Top badges earned
Coach
Give back 600
Ignite 5
Ignite 3
Ignite 1
View profile

Avatar
Coach
Employee
Jörg_Hoh
Employee

Likes

1,134 likes

Total Posts

3,161 posts

Correct reply

1,079 solutions
Top badges earned
Coach
Give back 600
Ignite 5
Ignite 3
Ignite 1
View profile
Jörg_Hoh
Employee

11-02-2019

Hi,

First of all, these are not orphaned nodes ...

No renderer for extension html, cannot render resource JcrNodeResource, type=nt:unstructured, superType=null, path=/content/envNode/www/en-us/banner-repository/banners/jcr:content/root/responsivegrid /custom_wrapper_58983/par/banner_container_cop_1825745486/par/par_copy/responsivegrid/spac er_copy_9611926

This means, that you have a resource which has no rendering information attached to it (most likely it is missing a resource type), but it is included in the rendering process. Use the "Recent Requests" page in the OSGI webconsole to find out which component in the hierarchy is including it. In your case I assume that you have a responsivegrid which iterates over its child resources and includes them (which is failing here).

So its not a really orphaned node but it served some purpose.

You should fix it, and I don't know if it's the right way just to delete them. You should define detailled criteria how to identify these resources. And then you should implement a custom cleanup process, maybe sling pipes might be a good framework to implement it.

Jörg

Avatar

Avatar
Validate 1
Level 1
teamu33465496
Level 1

Likes

0 likes

Total Posts

12 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
teamu33465496
Level 1

Likes

0 likes

Total Posts

12 posts

Correct reply

0 solutions
Top badges earned
Validate 1
View profile
teamu33465496
Level 1

11-02-2019

Hi Jorg,

We have decide that they are Orphan because they have no property  attached to it. It is difficult to manually go through all the nodes and check which node has no property attached to it. We want to run a script which deletes the Orphan Nodes on a regular basis.

Avatar

Avatar
Boost 250
MVP
Gaurav-Behl
MVP

Likes

250 likes

Total Posts

1,147 posts

Correct reply

283 solutions
Top badges earned
Boost 250
Establish
Give back 300
Give Back 50
Give Back 5
View profile

Avatar
Boost 250
MVP
Gaurav-Behl
MVP

Likes

250 likes

Total Posts

1,147 posts

Correct reply

283 solutions
Top badges earned
Boost 250
Establish
Give back 300
Give Back 50
Give Back 5
View profile
Gaurav-Behl
MVP

11-02-2019

If you really want to go down this route then use this -- On-Deploy Scripts​.  Provide a custom implementation using some business logic and execute it after understanding pros/cons. Take a backup, just in case if you happen to delete something that is a required functionality.

If you want to run it periodically, then create it as a service, attach a handler and run it via cron/jenkins/sling scheduler or similar at specified intervals.

HTH

Avatar

Avatar
Coach
Employee
Jörg_Hoh
Employee

Likes

1,134 likes

Total Posts

3,161 posts

Correct reply

1,079 solutions
Top badges earned
Coach
Give back 600
Ignite 5
Ignite 3
Ignite 1
View profile

Avatar
Coach
Employee
Jörg_Hoh
Employee

Likes

1,134 likes

Total Posts

3,161 posts

Correct reply

1,079 solutions
Top badges earned
Coach
Give back 600
Ignite 5
Ignite 3
Ignite 1
View profile
Jörg_Hoh
Employee

12-02-2019

You should not need to run this on a regular basis; in that case you would create constantly new nodes, which means your templates and components add "orphans" when they are inserted. And this would mean that your templates and components are not well maintained in the first place.

Jörg