Repoinit frequently giving issues on server restart | Community
Skip to main content
Level 6
September 11, 2023
Solved

Repoinit frequently giving issues on server restart

  • September 11, 2023
  • 2 replies
  • 3378 views

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:

  1. As this is quite inconvenient and we lose quite a lot of time on this, we should review the existing repo init scripts and ensure they run properly in all cases. For example, the script should still run OK in case some repository paths are missing, in case some of the properties already have some value (single value / multi-value), etc.
  2. We should also come up with some guidelines or best practices during development time to ensure these scripts are as stable as they can be and will never block the server startup due to some exceptions.

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!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by aanchal-sikka

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

 

 


@vani1012 

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.

  • "set endS to one" this give us result

  • set singleMultiValue{String[]} to "single" to a String[]. But, what we are getting is a String.

 

 

 

There is a discrepancy in forcibly using Arrays for a Single value.

2 replies

aanchal-sikka
Community Advisor
Community Advisor
September 11, 2023

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
Vani1012Author
Level 6
September 11, 2023

@aanchal-sikka Can you please share some inputs how we can improve config files and provide some best practices

aanchal-sikka
Community Advisor
Community Advisor
September 11, 2023

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

 

Aanchal Sikka
kautuk_sahni
Community Manager
Community Manager
September 12, 2023

@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. 

Kautuk Sahni