adobe / aem-project-archetype

Maven template to create best-practice websites on AEM.
https://experienceleague.adobe.com/docs/experience-manager-core-components/using/developing/archetype/overview.html
Apache License 2.0
547 stars 426 forks source link

Issue with a RepositoryInitializer config preventing AEM restarts #852

Closed mt33 closed 2 years ago

mt33 commented 2 years ago

Expected Behaviour

After deploying a new project, AEM can restart normally

Actual Behaviour

After deploying a new project, AEM restarts with a nasty error:

image

Reproduce Scenario (including but not limited to)

Building a project with

mvn -B archetype:generate -D archetypeGroupId=com.adobe.aem -D archetypeArtifactId=aem-project-archetype -D archetypeVersion=32 -D appTitle="NEW SPA" -D appId="spa" -D groupId="com.company" -D frontendModule=react -D aemVersion="6.5.11"

and deploying to a clean 6.5.11 instance with clean install -P autoInstallSinglePackage

Stop AEM

Start AEM

Steps to Reproduce

Remove file /apps/spa/osgiconfig/config/org.apache.sling.jcr.repoinit.RepositoryInitializer~spa.cfg.json

Re-deploy. AEM starts normally.

Config contents:

{
    "scripts": [
        "create path (sling:OrderedFolder) /content/dam/spa",
        "create path (nt:unstructured) /content/dam/spa/jcr:content",
        "set properties on /content/dam/spa/jcr:content",
        "set cq:conf{String} to /conf/spa",
        "set jcr:title{String} to \"ADSK SPA\"",
        "end"
    ]
}

Platform and Version

Archetype 32 AEM 6.5.11

Sample Code that illustrates the problem

Logs taken while reproducing problem

15.12.2021 10:32:07.512 *INFO* [FelixStartLevel] org.apache.sling.adapter Service [1098, [org.apache.sling.adapter.Adaption]] ServiceEvent REGISTERED
15.12.2021 10:32:07.512 *ERROR* [Apache Sling Repository Startup Thread #1] com.adobe.granite.repository.impl.SlingRepositoryManager Exception in a SlingRepositoryInitializer, SlingRepository service registration aborted
org.apache.sling.repoinit.parser.RepoInitParsingException: Encountered "" at line 1, column 47.
Was expecting one of:

    at org.apache.sling.repoinit.parser.impl.RepoInitParserService.parse(RepoInitParserService.java:54) [org.apache.sling.repoinit.parser:1.6.2]
    at org.apache.sling.jcr.repoinit.impl.RepositoryInitializerFactory.processRepository(RepositoryInitializerFactory.java:124) [org.apache.sling.jcr.repoinit:1.1.28]
    at org.apache.sling.jcr.base.AbstractSlingRepositoryManager.executeRepositoryInitializers(AbstractSlingRepositoryManager.java:610) [org.apache.sling.jcr.base:3.1.6]
    at org.apache.sling.jcr.base.AbstractSlingRepositoryManager.initializeAndRegisterRepositoryService(AbstractSlingRepositoryManager.java:558) [org.apache.sling.jcr.base:3.1.6]
    at org.apache.sling.jcr.base.AbstractSlingRepositoryManager.access$300(AbstractSlingRepositoryManager.java:92) [org.apache.sling.jcr.base:3.1.6]
    at org.apache.sling.jcr.base.AbstractSlingRepositoryManager$4.run(AbstractSlingRepositoryManager.java:527) [org.apache.sling.jcr.base:3.1.6]
Caused by: org.apache.sling.repoinit.parser.impl.ParseException: Encountered "" at line 1, column 47.
Was expecting one of:

    at org.apache.sling.repoinit.parser.impl.RepoInitParserImpl.generateParseException(RepoInitParserImpl.java:3824) [org.apache.sling.repoinit.parser:1.6.2]
    at org.apache.sling.repoinit.parser.impl.RepoInitParserImpl.jj_consume_token(RepoInitParserImpl.java:3706) [org.apache.sling.repoinit.parser:1.6.2]
    at org.apache.sling.repoinit.parser.impl.RepoInitParserImpl.setPropertiesStatement(RepoInitParserImpl.java:1762) [org.apache.sling.repoinit.parser:1.6.2]
    at org.apache.sling.repoinit.parser.impl.RepoInitParserImpl.parse(RepoInitParserImpl.java:76) [org.apache.sling.repoinit.parser:1.6.2]
    at org.apache.sling.repoinit.parser.impl.RepoInitParserService.parse(RepoInitParserService.java:50) [org.apache.sling.repoinit.parser:1.6.2]
    ... 5 common frames omitted
15.12.2021 10:32:07.512 *INFO* [Apache Sling Repository Startup Thread #1] com.adobe.granite.repository.impl.SlingRepositoryManager Stop requested
otavio-sousa-gauge commented 2 years ago

Hi @mt33, we had face same issue here. when we created a new repository on cloud manager and run it on local AEM, it broken and stoped work. The solution was create a org.apache.sling.jcr.repoinit.RepositoryInitializer-.config file.

Tylopilus commented 2 years ago

I can confirm this issue is also happening with the Cloud-SDK. Issue appeared on 2021.12.6151.20211217T120950Z-211100

Deleting the .cfg.json or replacing it's script into a -.config as @otavio-sousa-gauge suggests does resolve the issue

fdambrosio commented 2 years ago

thanks for the fix !

ChazUK commented 2 years ago

For anyone trying to search for this error message in the future.

HTTP ERROR 503 AuthenticationSupport service missing. Cannot authenticate request.
URI: /
STATUS: 503
MESSAGE: AuthenticationSupport service missing. Cannot authenticate request.
SERVLET: org.apache.felix.http.base.internal.dispatch.DispatcherServlet-5fa1be91