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.

Making Change to JCRResourceResolverFactoryImpl cause AEM services to restart. Why?

Avatar

Level 2

There is an OSGi configuration called org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl.

 

Here we specify the /etc/map path url shortening etc.

 

If we open this file, make a change and save it. Either by Felix Console, Incoming Content Package via Package Manager or via CRXDE Lite.
i.e. any change made to this will cause all AEM internal services to restart

 

this line below keeps repeating
CM Event Dispatcher (Fire ConfigurationEvent: pid=org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl)]

 

I think this is related to https://issues.apache.org/jira/browse/SLING-5602

But it never got resolved. I am using AEM 6.5.14

 

Steps to reproduce:
1.) Create an OSGI file:
/apps/myrpoject/config.author/org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl.xml

2.) Add Contents as:
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="sling:OsgiConfig"
resource.resolver.searchpath="[/apps,/libs,/apps/foundation/components/primary,/libs/foundation/components/primary]"
resource.resolver.enable.vanitypath="{Boolean}true"
resource.resolver.optimize.alias.resolution="{Boolean}true"
resource.resolver.required.providers="[org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProviderFactory]"
resource.resolver.default.vanity.redirect.status="{Long}302"
resource.resolver.mapping="[]"
resource.resolver.virtual="[]"
resource.resolver.vanity.precedence="{Boolean}false"
resource.resolver.vanitypath.whitelist="[/apps/,/libs/,/content/]"
resource.resolver.manglenamespaces="{Boolean}true"
resource.resolver.map.location="/etc/map"
resource.resolver.allowDirect="{Boolean}true"
resource.resolver.vanitypath.blacklist="[/content/usergenerated]"
resource.resolver.log.unclosed="{Boolean}false"/>

3.) push via crx packmgr or build. Make change to this file like 
change resource.resolver.map.location="/etc/map" to 
resource.resolver.map.location="/etc/maps" and SAVE.

See the AEM go full restart services mode for at least 30 min to 1 hour.

2 Replies

Avatar

Employee Advisor

Hi,

 

It seems that the issue you're experiencing is related to a known problem with the Apache Sling framework, specifically SLING-5602. This issue causes CM Event Dispatcher to repeatedly fire ConfigurationEvents when a change is made to the OSGi configuration file, leading to a long restart time for AEM internal services.

Avatar

Level 2

@ManviSharma Correct. How do we avoid this? Can we avoid it?

Why hasn't it been fixed yet?

 

I am using the xml style of OSGi configuration will there be any difference if I use the JSON style OSGi configuration. i.e. the one that is deployed as a JSON file.
{
"resource.resolver.mapping": [
"/content/aem-project/</", "/:/"
]
}

 

PS: How do I stop this from happening?