Hi All,
Some time ago, we started using Repository Initializer from Sling to perform some initial setup of eg paths and permissions:
https://sling.apache.org/documentation/bundles/repository-initialization.html
What we're seeing is that these frequently give issues on a server restart, also in UAT / PROD.
In case such a repo init script fails at package installation time, an exception is logged to the error.log file but nothing obvious happens. In case such an exception happens on server startup, the JCR repository doesn't get initialized and AEM won't start up at all. To remedy this, manual actions are needed every restart to remove the config file from disk and allow AEM to start up normally.
To remedy this, a few actions are needed:
Can you take a look at the suggestions above and ensure the config files are improved and that we have some guidelines to avoid similar issues in the future? Thanks!
Solved! Go to Solution.
Views
Replies
Total Likes
set properties on /endkeyword
# using "end" instead of "endS" below causes parsing to fail
set endS to one
set two to endS
end
set properties on /forcedMultiValue
set singleMultiValue{String[]} to "single"
set singleLongMultiValue{Long[]} to 1243
end
The documentation shares 2 ways, in which we can set property.
There is a discrepancy in forcibly using Arrays for a Single value.
Hello @Vani1012
Thanks for sharing your insights. It would definitely be a good improvement.
Since, this is a suggestion and not a question, requesting you to please post it as an idea, in "Ideas" Tab.
@aanchal-sikka Can you please share some inputs how we can improve config files and provide some best practices
Hello @Vani1012
The repo-init scripts are meant to work during server start. If you are noticing error, you would need to fix them.
We shouldn't need to remove and put them back in.
- Arre these custom scripts?
- If yes, please share the errors logs.
-Why do we need to alter values with repo-init? (Single->Multi)
For now, we need to make sure, paths are available, before setting ACL or adding property.
The proper jcr:primaryType need to be used for creating nodes, as these can't be altered later
It will be difficult to debug with only configs. In original post you mentioned about exceptions, can you possibly share the same?
04.08.2023 07:28:24.378 *ERROR* [Apache Sling Repository Startup Thread #1] com.adobe.granite.repository.impl.SlingRepositoryManager Exception in a SlingRepositoryInitializer, SlingRepository service registration aborted javax.jcr.RepositoryException: Applying repoinit operation failed despite retry; set loglevel to DEBUG to see all exceptions. Last exception message was: Failed to set ACL (javax.jcr.PathNotFoundException: Cannot set ACL on non-existent path /conf/brandsv2/ceccatocluster) AclLine ALLOW {paths=[/conf/brandsv2/ceccatocluster], privileges=[jcr:all]}
07.09.2023 10:43:38.612 *INFO* [Apache Sling Repository Startup Thread #1] org.apache.sling.jcr.repoinit.impl.NodePropertiesVisitor Setting properties on nodePath '/content/brands/isravision/jcr:content' 07.09.2023 10:43:38.621 *ERROR* [Apache Sling Repository Startup Thread #1] com.adobe.granite.repository.impl.SlingRepositoryManager Exception in a SlingRepositoryInitializer, SlingRepository service registration aborted javax.jcr.RepositoryException: Applying repoinit operation failed despite retry; set loglevel to DEBUG to see all exceptions. Last exception message was: Unable to set properties on path [/content/brands/isravision/jcr:content]:javax.jcr.ValueFormatException: Can not assign a single value to multi-valued property: cq:allowedTemplates = /conf/brandsv2/isravision/settings/wcm/templates/(?!xf-).* at org.apache.sling.jcr.repoinit.impl.RepositoryInitializerFactory.applyOperations(RepositoryInitializerFactory.java:176) [org.apache.sling.jcr.repoinit:1.1.38] at org.apache.sling.jcr.repoinit.impl.RepositoryInitializerFactory.processRepository(RepositoryInitializerFactory.java:129)
@aanchal-sikka is there a possibility even though we pass single value to multi valued property it should run the script without interruption
Hello @Vani1012
You should raise the bug for that array enforcement is not happening for single values.
set properties on /content/dam/techrevelaemsite/jcr:content
set cq:conf{String} to /conf/techrevelaemsite
set jcr:title{String} to "Techrevel AEM Site"
set test4{String[]} to "Techrevel AEM Site"
end
As per [0], following should create forced multi values.
set properties on /forcedMultiValue
set singleMultiValue{String[]} to "single"
set emptyMultiValue{String[]} to
set singleLongMultiValue{Long[]} to 1243
set emptyLongMultiValue{Long[]} to
end
[0]: https://sling.apache.org/documentation/bundles/repository-initialization.html
This would have avoided the exception in first place.
Which version of AEM are you using currently? Can you possibly try with latest Service pack?
I am using 6.5.16 service pack,
Can you please explain a bit more the second point
As per [0], following should create forced multi values.
set properties on /forcedMultiValue set singleMultiValue{String[]} to "single" set emptyMultiValue{String[]} to set singleLongMultiValue{Long[]} to 1243 set emptyLongMultiValue{Long[]} to end
set properties on /endkeyword
# using "end" instead of "endS" below causes parsing to fail
set endS to one
set two to endS
end
set properties on /forcedMultiValue
set singleMultiValue{String[]} to "single"
set singleLongMultiValue{Long[]} to 1243
end
The documentation shares 2 ways, in which we can set property.
There is a discrepancy in forcibly using Arrays for a Single value.
@Vani1012 Do you find the suggestions from users useful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity.
Views
Replies
Total Likes