New resource resolver search path breaks template policies
Adding a resource resolver search path /apps/proj1
via script disrupts all policies set in /conf/proj1/settings/wcm/policies
. Conversely, eliminating the/apps/proj1
line from the cfg.json
script restores the policies to their former functional state. Follow the instructions in the article to fix this problem.
Description description
Environment
Adobe Experience Manager 6.5
Issue/Symptoms
Add a resource resolver search path ("/apps/proj1")
through script:
org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl.cfg.json
{
"resource.resolver.searchpath":
"/apps/proj1",
"/apps",
"/libs"
}
This breaks all policies defined in /conf/proj1/settings/wcm/policies
Definitions in policies.xml
exist, but it is impossible to relate them to editable page templates, and all previous policy selections in templates are broken. Only removing the line '/apps/proj1'
from the cfg.json
script, gets the defined policies back to the previous working state.
This can be reproduced using the following steps:
-
Create any policy related to a specific component on a specific page template.
-
Save the template with the chosen policy.
-
Add script with:
code language-none resource.resolver.searchpath": "/apps/projname"...
-
Confirm that the defined policy for the template and related component can no longer be selected in the dropdown on edit template.
Resolution resolution
As best practice, avoid amending /apps
and /libs
. Sling would look for components First in /apps
, then /libs
.
Sling will search for resources by going through this list in order. This means that items in /apps (unless specified using /libs at the beginning of the path) will be found first. This is how the overlay works.