Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

WCMMode disabled is incorrect in publisher

Avatar

Level 6

Hi all,

 

Our AEM 6.5 publisher cannot detect the correct WCMMode. The start script runs with an option "

-Dsling.run.modes=publish,dev,crx3,crx3tar,nosamplecontent". 

JSP code segment:

boolean isWcmDisabled = WCMMode.fromRequest(request) == WCMMode.DISABLED;

The isWcmDisabled is false in publisher, should be true. Now all the wrong preloads are coming up. 

 

It is working on AEM 6.0. Any idea?

 

Thanks!

 

-kt

 

14 Replies

Avatar

Community Advisor

@kevingtan 

Are you using any service packs?

Please try intsalling the service packs.

Avatar

Level 6

@Manu_Mathew_ 

 

Thanks for your instruction. I don't have the permission to download the service pack. Will try that and see what will happen.

 

Thanks again!

Avatar

Level 6

Looks the runmode is author instead of publisher. Don't know why it can't pick the runmodes from the start script.

Avatar

Community Advisor

Hi @kevingtan 

 

Please stop the instance.

 

Update the start script with the below line:

 

if [ -z "$CQ_RUNMODE" ]; then
CQ_RUNMODE='publish,dev,crx3,crx3tar,nosamplecontent'
fi

 

Start the instance and it should fix the issue.

 

Thanks!

Avatar

Level 6

It has been like that. Doesn't look like coming from the line of code.

Avatar

Level 6

When we check the process:

ps -ef | grep -i java

We can see

java -server -Xms1024m -Xmx2048m -XX:MetaspaceSize=512m -XX:MaxMetaspaceSize=2048m -Djavax.net.ssl.trustStore=/apps/crx-quickstart/ssl/trusted.keystore -Djava.awt.headless=true -Xverify:none -noverify -Dsling.run.modes=publish,dev,crx3,crx3tar,nosamplecontent -jar crx-quickstart/app/cq-quickstart-6.5.0-standalone-quickstart.jar start -c crx-quickstart -i launchpad -p 4503 -Dsling.properties=conf/sling.properties

 

So I stopped the process, running the command as above directly from the terminal, I will see a lot of ESAPI errors. I don't know what it is. Obviously it's missing the esapi bundle, but I don't know why it's related to that. I went ahead to download and install it (https://search.maven.org/artifact/org.owasp.esapi/esapi/2.2.1.0/jar). Then it reported an IOException, 

java.io.IOException: Bundle-SymbolicName header missing, cannot install bundle

So I unpacked it and there is really no symblic name. I gave up installing it.

 

The 6.0 doesn't look like experiencing the same situation.

 

Thanks!

Avatar

Employee Advisor

What is the return value of

WCMMode.fromRequest(request)

 

Avatar

Level 6

Hi @Jörg_Hoh , it's the default value "dev, s7connect, crx3, author, samplecontent, crx3tar". Both java and jsp code are showing the same value on author and publisher.  The process shows the instance is using the custom runmodes:

ps -ef | grep -i java

 

java -server -Xms1024m -Xmx2048m -XX:MetaspaceSize=512m -XX:MaxMetaspaceSize=2048m -javax.net.ssl.trustStore=/apps/mysite/crx-quickstart/ssl/trusted.keystore -Djava.awt.headless=true -Xverify:none -noverify -Dsling.run.modes=publish,dev,crx3,crx3tar,nosamplecontent -jar crx-quickstart/app/cq-quickstart-6.5.0-standalone-quickstart.jar start -c crx-quickstart -i launchpad -p 4503 -Dsling.properties=conf/sling.properties

 

The author process shows the same, except one of the runmodes is author instead of publish. It's weird that the geometrixx is not installed even if the runmodes show samplecontent. Somehow the instance is started with custom runmodes but get altered after starting up? conf/sling.properties file doesn't have anything related to runmodes.

 

Thanks!

Avatar

Employee Advisor

The wcmmode is not necessarily tied to the runmode(s); the only relevant change is the runmode during the installation (initial startup), where based on runmodes packages or configuration could be installed.

That means if you set the runmode "nosamplecontent" after having bootstrapped an AEM instance, it does not have any effect.

 

Regarding the WcmMode: Can you find out what the actual WcmMode is returned by the code snippet you posted? We just know that it is not "WcmMode.DISABLED".

Avatar

Level 6

HI @Jörg_Hoh ,

 

I figured the isWcmDisabled wasn't correct so starting to trace everything.

Jsp Code:

 

boolean isWcmEdit = WCMMode.fromRequest(request) == WCMMode.EDIT;

boolean isWcmDisabled = WCMMode.fromRequest(request) == WCMMode.DISABLED;

boolean isWcmPreview = WCMMode.fromRequest(request) == WCMMode.PREVIEW;

boolean isWcmDesign = WCMMode.fromRequest(request) == WCMMode.DESIGN;

pageContext.setAttribute("isWcmEdit", isWcmEdit);

pageContext.setAttribute("isWcmDesign", isWcmDesign);

pageContext.setAttribute("isWcmDisabled", isWcmDisabled);

pageContext.setAttribute("isWcmPreview", isWcmPreview);

 

// this segment of code was placed later

pageContext.setAttribute("runModes", sling.getService(org.apache.sling.settings.SlingSettingsService.class).getRunModes().toString());

 

HTML:

isWcmDesign==>${isWcmDesign}, isWcmDisabled==>${isWcmDisabled}, isWcmPreview==>${isWcmPreview}, isWcmEdit==>${isWcmEdit}, runmodes==>${runModes} 

 

The output is:

isWcmDesign==>false, isWcmDisabled==>true, isWcmPreview==>false, isWcmEdit==>false, runmodes==>[dev, s7connect, crx3, nosamplecontent, publish, crx3tar]

 

The isWcmDisabled was "false", runmodes was default. Since the isWcmDisabled was false, the sidekick was popping up. We also have a few services relying on the author run mode, such as crx observation. So both the WcmMode and run modes are essential to us. But I didn't know WcmMode not necessarily tied to the run modes.

 

Thanks!

 

-kt

 

Avatar

Employee Advisor

Thanks for explaining the way how your resolved your question by yourself. 

Avatar

Employee Advisor

no, the wcmmode is not directly tied to the runmode. IIRC the "Day CQ WCM Filter" OSGI config controls the default setting, and this default setting is set on the initial startup based on the runmodes. But after this initial startup it is not changed anymore and you are free to change it yourself (although it does not make sense to do that).

Avatar

Level 6

Hi all, 

I figured the problem. It was the name of the jar file.

After unpacking the jar file, I left it intact, which cuased problem. According to Adobe, the initial startup will set the runmodes for the whole life of the instance, so the subsequent filename modification won't work.

 

Now the prodecure of the setup will be:

unpack the jar file

mv cq-default.jar aem65-publish-4503.jar [pattern: prefix-<runmode>-port], as stated from adobe.

run puppet to update the config

start the script

 

This works on publisher except it inserts the s7connect as [dev, s7connect, crx3, nosamplecontent, publish, crx3tar]

 

Author is still the same, loading the default even if I modified the file name [aem65-author-4502] before starting up the server. 

 

Thank you all!

 

-kt