Wednesday, March 21, 2018

How to resolve Adobe Experience Manager(AEM) pointing to Search and Promote(S&P) Stage environment?

How to resolve Adobe Experience Manager(AEM) pointing to Search and Promote(S&P) Stage environment?


Recently i have faced a issues on AEM publisher pointing to Search and Promote(S&P) stage environment irrespective of the environment configuration in OSGI configuration( Adobe Search&Promote Integration )

Search_and_Promote_integration_config

How to confirm AEM is pointing to S&P stage environment:


Check the content of searchformxml property from /etc/cloudservices/search-promote/<<S&P Config Name>>/jcr:content and check the <action> URL

Stage - <action>http://stage.xxxxx.guided.ss-omtrdc.net</action>
Live - <action>http://xxxxx.guided.ss-omtrdc.net</action>

Search_and_Promote_cloud_config_searchformxml


The following steps can be followed as a workaround:


Decode the data if it is already encoded(HTML Decoder) - searchformxml property from /etc/cloudservices/search-promote/<<S&P Config Name>>/jcr:content

Remove <input type="hidden" name="sp_staged" value="1" />

Change the following URLs to point to live configuration

//content.atomz.com/xxxxx/stage/autocomplete_data.js to //content.atomz.com/xxxxx/publish/autocomplete_data.js
//content.atomz.com/xxxxx/stage/autocomplete_styles.css to //content.atomz.com/xxxxx/publish/autocomplete_styles.css

Change the action to point to live URL

<action>http://stage.xxxxx.guided.ss-omtrdc.net</action> to <action>http://xxxxx.guided.ss-omtrdc.net</action>


e.g - this will be different based on your S&P configuration

<searchform>
<autocomplete>
<enabled>1</enabled>
<css><![CDATA[<link rel="stylesheet" type="text/css" href="//content.atomz.com/xxxxxx/publish/autocomplete_styles.css?sp_css_param=1" />]]></css>
<form-content><![CDATA[<div id="autocomplete"></div>]]></form-content>
<javascript><![CDATA[<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/yui/2.8.0r4/build/utilities/utilities.js" ></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/yui/2.8.0r4/build/datasource/datasource-min.js" ></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/yui/2.8.0r4/build/autocomplete/autocomplete-min.js"></script>
<script type="text/javascript" src="//content.atomz.com/xxxxxx/publish/autocomplete_data.js?sp_js_param=5"></script>]]></javascript>
</autocomplete> <tnt> <enabled>0</enabled> <form-content><![CDATA[<div id="tntMBox"></div>]]></form-content> <javascript><![CDATA[<script type="text/javascript">
(function(){var searchTextBoxId='q';var mboxContainerId='tntMBox';var mboxName='searchParamMbox';function removeEventSimple(obj,evt,fn)
{if(obj.removeEventListener)
obj.removeEventListener(evt,fn,false);else if(obj.detachEvent)
obj.detachEvent('on'+evt,fn);}
function addEventSimple(obj,evt,fn)
{if(obj.addEventListener)
obj.addEventListener(evt,fn,false);else if(obj.attachEvent)
obj.attachEvent('on'+evt,fn);}
function setSearchFormMbox()
{mboxDefine(mboxContainerId,mboxName);mboxUpdate('searchParamMbox');removeEventSimple(el,'keydown',setSearchFormMbox);}
var el=document.getElementById(searchTextBoxId);if(el)
addEventSimple(el,'keydown',setSearchFormMbox);})();</script>
]]></javascript> </tnt> <form>
<name>searchform</name>
<id>searchform</id>
<action>http://xxxxxx.guided.ss-omtrdc.net</action>
<inputs>
<input>
<type><![CDATA[text]]></type>
<id><![CDATA[q]]></id>
<name>q</name>
<value></value>
</input>
<input>
<type><![CDATA[submit]]></type>
<value><![CDATA[Search]]></value>
</input>
</inputs>
</form>
</searchform>

If the same S&P configuration with live option is enabled in any other server then copy and replace the value of searchformxml in /etc/cloudservices/search-promote/<<S&P Config Name>>/jcr:content

I have faced this issue in Adobe Experience Manager(AEM) 6.2 version

Tuesday, March 20, 2018

Different approaches to calculate content/DAM folders size in Adobe Experience Manager(AEM)

Different approaches to calculate content/DAM folders size in Adobe Experience Manager(AEM)

In Adobe Experience Manager(AEM), there is no direct approach to get the size of the specific content node or DAM.

This post explains the different approach to calculate the size for specific content or DAM path

Creating package through package manager:


Create the package through package manager for specific content/DAM path.
Build and download the package and calculate the size.

AEM_create_package_calculate_size


AEM_create_package_calculate_size

This approach will create space issue in server while creating the packages.

Calculate size through WebDav client:


Use any WebDav client to calculate the size of the DAM folders, I have used WinScp tool for size calculation

AEM_Webdav_client_calculate_size


AEM_Webdav_client_calculate_size


AEM_Webdav_client_calculate_size


This approach
- Can be only used for DAM assets as HTML contents are mapped as folders in WedbDav(AEM configuration)
- Can be only used in WebDav enabled AEM instances

Monday, March 12, 2018

Exception in thread "main" java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.format(Ljava/lang/String;Ljava/lang/Object;)Lorg/slf4j/helpers/FormattingTuple;Jcr2davRepositoryFactory

I was getting the below exception while connecting to AEM JCR repository through Java API(JCR webdav) using Jcr2davRepositoryFactory.

Exception in thread "main" java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.format(Ljava/lang/String;Ljava/lang/Object;)Lorg/slf4j/helpers/FormattingTuple;
at org.slf4j.impl.Log4jLoggerAdapter.debug(Log4jLoggerAdapter.java:229)
at org.apache.jackrabbit.jcr2spi.Jcr2spiRepositoryFactory$RepositoryConfigImpl.getCacheBehaviour(Jcr2spiRepositoryFactory.java:272)
at org.apache.jackrabbit.jcr2spi.Jcr2spiRepositoryFactory$RepositoryConfigImpl.<init>(Jcr2spiRepositoryFactory.java:229)
at org.apache.jackrabbit.jcr2dav.Jcr2davRepositoryFactory.getRepository(Jcr2davRepositoryFactory.java:104)
at org.apache.jackrabbit.jcr2dav.Jcr2davRepositoryFactory.getRepository(Jcr2davRepositoryFactory.java:87)
at workarea.core.GetRepositorySize.main(GetRepositorySize.java:25)

To fix the issue add the slf4j-log4j12 with lower version and also exclude jcl-over-slf4j from jackrabbit-jcr2dav dependency.

<dependency>
<groupId>org.slf4j</groupId>
    <artifactId>slf4j-log4j12</artifactId>
    <version>1.5.0</version>
</dependency>
 
<!-- https://mvnrepository.com/artifact/org.apache.jackrabbit/jackrabbit-jcr2dav -->
<dependency>
    <groupId>org.apache.jackrabbit</groupId>
    <artifactId>jackrabbit-jcr2dav</artifactId>
    <version>2.17.1</version>
    <scope>provided</scope>
    <exclusions>     
        <exclusion>
        <groupId>org.slf4j</groupId>
        <artifactId>jcl-over-slf4j</artifactId>
        </exclusion>
    </exclusions>
</dependency>