Tuesday, June 21, 2016

Dispatcher Cache Invalidation for Multi Site Configuration - Adobe CQ5(AEM)

Dispatcher Cache Invalidation for Multi Site Configuration - Adobe CQ5(AEM)

This post will explain the approach to invalidate the cache for particular site in multi site configuration - Adobe CQ5(AEM).

Recently, i was working on a dispatcher caching issue with multi site configuration - The cache was not getting invalidated in all the dispatcher.

The setup is with multiple dispatcher connected via load balancer. The load balancer will route the request to individual dispatchers via round robin algorithm. The dispatcher is configured with individual virtual host and farm for every site(Load balanced DNS is used).

The flush agent was configured in publisher for every site with load balanced DNS(the flush agent was equal to number of sites configured in dispatcher) - The issue here is when ever publisher send the invalidation request that is not reaching the corresponding dispatcher as the flush agent is configured with load balanced DNS for invalidation URI - The request will be send to random dispatcher from the load balancer due to this the cache will not be invalidated in all the dispatcher.

Solution:

Create a flush agent in individual publisher that points to individual dispatcher(based on the renders configuration). The flush agent should be configured with dispatchers server name(one flush agent in one publisher)

http://dispatcher1.server.name:80/dispatcher/invalidate.cache




Sunday, June 19, 2016

Query the pages with the properties of child node - Adobe CQ5/AEM

Query the pages with the properties of child node - Adobe CQ5/AEM

SELECT * FROM [cq:Page] AS page WHERE ISDESCENDANTNODE(page ,"<<Parent folder of pages>>")  AND [jcr:content/<<child node name>>/<<child node property>>]=<<value>>

e.g

SELECT * FROM [cq:Page] AS page WHERE ISDESCENDANTNODE(page ,"/content")  AND [jcr:content/test_node/test_property=test

http://<<AEM Host>>:<<AEM Port>>/crx/explorer/ui/search.jsp - Paste the query and click on Search Now.


Friday, April 29, 2016

Only a type can be imported. xxxxxx resolves to a package - AEM/Adobe CQ5

Only a type can be imported. xxxxxx resolves to a package - AEM/Adobe CQ5

We were receiving the following error in run time due to this the pages got broken. The same scenario was working fine earlier and broken without any code or config change to the server.

We have tried multiple options as follows without any luck
  • Re-deploying the code to affected server
  • Restarting the server
  • Removing run time class files - /var/classes/org/apache
  • Recompile/Clear the JSP classes - http://www.albinsblog.com/2016/04/how-to-clearrecompile-jsp-classes-in-AEM-6.1.html
We could not able to identify the root cause but as a work around manually added a space to the component and saved through CRXDE and that helped to fix the issue.


How to disable the online compaction - AEM/Adobe CQ5

How to disable the online compaction - AEM/Adobe CQ5

Adobe Experience Manager(AEM) 6.1 will have daily job scheduled and that will perform the online compaction.

Some times this may cause performance issue when the online compaction takes more time to complete due to load or authoring.

As a solution the online compaction job can be disabled and offline compaction can be used whenever required based on the maintenance window.

Steps to disable online compaction:

  •  Go to CRXDE path - /libs/granite/operations/config/maintenance/granite:daily/granite:RevisionGC
  • Changed run mode from crx3 to crx3-disabled
  • Save


Friday, April 22, 2016

How to modify the scheduler time for daily and weekly maintenance jobs - Adobe Experience Manager(AEM) 6.1?

How to modify the scheduler time for daily and weekly maintenance jobs - Adobe Experience Manager(AEM) 6.1?

This post will explain the steps to modify the scheduler time for daily and weekly maintenance jobs in Adobe Experience Manager(AEM) 6.1.

To change the scheduled time of the jobs:

Login to CRXDE and navigate to /libs/granite/operations/config/maintenance/granite:weekly or /libs/granite/operations/config/maintenance/granite:daily

Change the windowStartTime and windowEndTime accordingly to change the schedule time of the job.




Thursday, April 14, 2016

How to manage the i18 translation in Adobe CQ5 (AEM)

How to manage the i18 translation in Adobe CQ5 (AEM)

This post will explain how to manage the i18 translation in Adobe CQ5 (AEM)

Follow the below URL to create the i18 language nodes for first time.

The translator.html can be used to manage the i18 translation for different languages.


Here you can add/delete modify keys and language values.

Whenever we perform any operation the same can be viewed from CRXDE – under the language node created as part of the first step.



Wednesday, April 6, 2016

How to restrict crawling/indexing of specific URLs in Adobe Search and Promote(Adobe S&P)

How to restrict crawling/indexing of specific URLs in Adobe Search and Promote(Adobe S&P)

Some cases we may need to index specific type of URLs from the website and excluding all other URLs available.

The URL Masks can be used in Adobe S&P to achieve this.

URL mask will help us to define the rules to include or exclude the specific URLs during the indexing.

We will be able to define include and exclude rules

Include - pattern that specifies the URLs will be indexed
Exclude - pattern that specifies the URLs will be excluded from the indexing.

To index the URLs that is starting with mask.


The crawler will index all the URLs that starts with https://server.com/content/doc



Tuesday, April 5, 2016

How to Clear/Recompile the JSP classes in Adobe Experience Manager(AEM) 6.1

How to Clear/Recompile the JSP classes in Adobe Experience Manager(AEM) 6.1

Sometime when we are deploying the packages, the JSP classes will not get compiled automatically in Adobe Experience Manager(AEM) 6.

We can follow the below option to clear/recompile the JSP classes.

Login to - http://<AEM HOST>:<AEM PORT/system/console/slingjsp

Click on Recompile all JSPs



Wednesday, February 10, 2016

Restricitng the content access to authenticated user - Adobe CQ5/AEM

Restricting the content access to authenticated user - Adobe CQ5/AEM

By default anonymous user in Adobe Experience Manager(AEM) will have the read access to content, so the content can be accessed via dispatcher/publisher directly without providing any credential.

This blog will explain how to restrict the content access to only authenticated users via dispatcher(including cached content) and publisher.

Remove the access of Anonymous user for content node in publisher


Create a user sample1 in publisher and provide the read access for content node (Multiple users can be created based on the requirement)



Monday, February 8, 2016

Enabling basic authentication for different directories with different credentials in dispatcher - Adobe CQ5/AEM

Enabling basic authentication for different directories with different credentials in dispatcher - Adobe CQ5/AEM

Separate credential for two different directories:

Create the .httpaccess for different directories

htpasswd -c /etc/httpd/conf/dispatcher.htaccess <username>
htpasswd -c /etc/httpd/conf/dispatcher1.htaccess <username>

Add the below configuration in the httpd.conf

<LocationMatch ^/content/sample1*>
# unsets authorization header when sending request to AEM
RequestHeader unset Authorization
SetEnvIf Request_URI ^/content/sample1* auths=0
AuthName "Please login to access the site"
AuthType Basic
AuthUserFile /etc/httpd/conf/dispatcher.htaccess
# first, allow everybody
Order Allow,Deny
Satisfy any
Allow from all
Require valid-user
# then, deny only if required
Deny from env=auths
</LocationMatch>

<LocationMatch ^/content/sample2*>
# unsets authorization header when sending request to AEM
RequestHeader unset Authorization
SetEnvIf Request_URI ^/content/sample2* auths=1
AuthName "Please login to access the press release"
AuthType Basic
AuthUserFile /etc/httpd/conf/dispatcher1.htaccess
# first, allow everybody
Order Allow,Deny
Satisfy any
Allow from all
Require valid-user
# then, deny only if required
Deny from env=auths
</LocationMatch>

Restart the dispatcher

Now you will be able to access /content/sample1 and /content/sample2 with different credential

There is a another scenario, separate credential for particular directory and rest of all the directories will use the same credentials.

Create the .httpaccess for different directories

htpasswd -c /etc/httpd/conf/dispatcher.htaccess <username>
htpasswd -c /etc/httpd/conf/dispatcher1.htaccess <username>

<Location />
# unsets authorization header when sending request to AEM
RequestHeader unset Authorization
SetEnvIf Request_URI ^/content/* auths=1
SetEnvIf Request_URI ^/content/sample2* auths=0
AuthName "Please login to access the site"
AuthType Basic
AuthUserFile /etc/httpd/conf/dispatcher.htaccess
# first, allow everybody
Order Allow,Deny
Satisfy any
Allow from all
Require valid-user
# then, deny only if required
Deny from env=auths
</Location>

<LocationMatch ^/content/sample2*>
# unsets authorization header when sending request to AEM
RequestHeader unset Authorization
SetEnvIf Request_URI ^/content/sample2* auths=1
AuthName "Please login to access the press release"
AuthType Basic
AuthUserFile /etc/httpd/conf/dispatcher1.htaccess
# first, allow everybody
Order Allow,Deny
Satisfy any
Allow from all
Require valid-user
# then, deny only if required
Deny from env=auths
</LocationMatch>

Restart the server.


Friday, January 15, 2016

Not able to access the siteadmin and useradmin pages - Adobe CQ5/AEM

Not able to access the siteadmin and useradmin pages - Adobe CQ5/AEM

We were not able to access the useradmin,siteadming and other website pages in one of our AEM/CQ5 publisher but was able to access the crxde and system console.

After analysis the issue is due to some of the bundles were stopped(100+), we tried to start those bundles manually without any luck.

The following was the exception in the log file.

11.01.2016 16:48:47.307 *ERROR* [FelixDispatchQueue] com.day.cq.collab.cq-collab-core FrameworkEvent ERROR (org.osgi.framework.BundleException: Unresolved constraint in bundle com.day.cq.collab.cq-collab-core [166]: Unable to resolve 166.0: missing requirement [166.0] osgi.wiring.package; (&(osgi.wiring.package=com.day.cq.collab.commons)(version>=0.0.0)(!(version>=5.7.0))) [caused by: Unable to resolve 165.0: missing requirement [165.0] osgi.wiring.package; (osgi.wiring.package=com.day.cq.wcm.api) [caused by: Unable to resolve 288.1: missing requirement [288.1] osgi.wiring.package; (osgi.wiring.package=com.day.cq.tagging) [caused by: Unable to resolve 218.1: missing requirement [218.1] osgi.wiring.package; (&(osgi.wiring.package=com.day.cq.search)(version>=1.1.0)(!(version>=2.0.0))) [caused by: Unable to resolve 209.1: missing requirement [209.1] osgi.wiring.package; (&(osgi.wiring.package=org.apache.abdera.ext.media)(version>=1.0.0)(!(version>=2.0.0)))]]]])

This error points to missing package of org.apache.abdera.ext.media and this belongs to the bundle - Abdera Extensions - Media.
After looking into the system console, the bundle is not there and it got uninstalled(not sure how it got uninstalled).

Follow the below steps to resolve the issue.

Identify the bundle id from another environment.




Sunday, December 6, 2015

Configuring same short URL/Vanity URL for different sites with https – AEM/Adobe CQ5

This post will explain how to configure same short URL/Vanity URL for different sites that is accessible through https in Adobe CQ5/AEM.

Recently we had a scenario to be implemented, two different websites needs to be accessed with same URL and with https protocol.
e.g
https://example1.com/en.html
https://example2.com/en.html

Both the sites are mapped to different nodes as below

https://example1.com/en.html  --> /content/example1/en
https://example2.com/en.html --> /content/example2/en

Create the redirect rules in dispatchers, inside the corresponding virtual host (httpd.conf) to redirect the http request to https and to shorten the URL’s .

RewriteRule ^/content/example1/(.*)$  /$1 [NE,L,R=301]

RewriteCond %{HTTPS} off
RewriteRule ^/$ https:// example1.com/en.html
RewriteRule ^/en.html https:// example1.com/en.html
RewriteRule ^/en/(.*)$ https:// example1.com/en/$1

Repeat the same for example2.com and for all the dispatchers.

Mapping in publisher :

Go to <<AEM Publisher Host>>:4503/system/console/configMgr with admin credentials. Search for Apache Sling Resource Resolver, and change the value of mapping location from /etc/map to /etc/map.publish




Sunday, October 4, 2015

Upgrading the dispatcher module in Adobe Experience Manager(AEM)

Upgrading the dispatcher module in Adobe Experience Manager(AEM)

Download the required dispatcher module version from the following URL 

https://www.adobeaemcloud.com/content/companies/public/adobe/dispatcher/dispatcher.html 

Extract the dispatcher module 

tar -xvzf <dispatcher-xxxxxxxx.tar.gz> (linux) 

Copy the extracted dispatcher-xxxxxxxxxx.so file to the module folder of the server. 



Modify the /etc/httpd/conf/httpd.conf file - remove the previous dispatcher module and add the new version. 



Tuesday, September 29, 2015

502 Bad Gateway while accessing /libs/cq/security/userinfo.json via telnet after upgrading to Adobe Experience Manager(AEM) 6.1

502 Bad Gateway while accessing /libs/cq/security/userinfo.json via telnet after upgrading to Adobe Experience Manager(AEM) 6.1

We were using /libs/cq/security/userinfo.json url in BIG-IP via telnet to check the staus of the server(heartbeat check of Adobe Experience Manager(AEM) servers) to control the availablity of servers in BIG-IP.

This is working fine in Adobe Experience Manager(AEM) 5.6.1 but it stopped working after upgrading AEM to 6.1(the server status is down in BIG-IP even though the server is up).

The same URL is working fine using wget,curl command and also from browsers, only not working via telnet(This issue is only via dispatcher but it is working fine directly with publisher)

Trying 10.xxx.xxx.xxx...
Connected to 10.xxx.xxx.xxx.
Escape character is '^]'.
GET /libs/cq/security/userinfo.json
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>502 Bad Gateway</title>
</head><body>
<h1>Bad Gateway</h1>
<p>The proxy server received an invalid
response from an upstream server.<br />
</p>
<hr>
<address>Apache/2.2.15 (Oracle) Server at xxxxxxxxxxx Port 80</address>
</body></html>
Connection closed by foreign host.

The actual root cause of the issue is the dispatcher module is not upgared as per the requirement.

The issue got resolved after upgrading the dispatcher module to latest version 4.1.10.

bash-3.2$ telnet 10.xxx.xxx.xxx 80
Trying 10.xxx.xxx.xxx...
Connected to 10.xxx.xxx.xxx.
Escape character is '^]'.
GET /libs/cq/security/userinfo.json
{"userID":"anonymous","userName":"anonymous","userName_xss":"anonymous","home":"/home/users/a/anonymous","impersonated":false,"allowedApps":[],"preferences":{}}
Connection to 10.xxx.xxx.xxx closed by foreign host.



Saturday, September 26, 2015

java.lang.NullPointerException:null at com.adobe.granite.workflow.core.WorkflowSessionFactory.isSuperUser(WorkflowSessionFactory.java:298) - AEM/Adobe CQ5

java.lang.NullPointerException:null at com.adobe.granite.workflow.core.WorkflowSessionFactory.isSuperUser(WorkflowSessionFactory.java:298) - AEM/Adobe CQ5

The components are not listed in sidekick and the sidekick is empty while opening the pages in author with the following exception.


 26.09.2015 07:29:40.868 *ERROR* [10.194.0.83 [1443270580848] GET /libs/wcm/core/content/pageinfo.json HTTP/1.1] org.apache.sling.engine.impl.SlingRequestProcessorImpl service: Uncaught Throwable
java.lang.NullPointerException: null at com.adobe.granite.workflow.core.WorkflowSessionFactory.isSuperUser(WorkflowSessionFactory.java:298) at com.adobe.granite.workflow.core.WorkflowSessionFactory.getWorkflowSession(WorkflowSessionFactory.java:326) at com.adobe.granite.workflow.core.WorkflowSessionFactory.getAdapter(WorkflowSessionFactory.java:461) at org.apache.sling.adapter.internal.AdapterManagerImpl.getAdapter(AdapterManagerImpl.java:147)
 at com.day.cq.workflow.impl.CQWorkflowService.getWorkflowSession(CQWorkflowService.java:148) at com.day.cq.wcm.core.impl.DefaultPageStatusProvider.updatePageInfo(DefaultPageStatusProvider.java:155) at com.day.cq.wcm.core.impl.servlets.PageInfoServlet.doGet(PageInfoServlet.java:188)
 at org.apache.sling.api.servlets.SlingSafeMethodsServlet.mayService(SlingSafeMethodsServlet.java:269) at org.apache.sling.api.servlets.SlingSafeMethodsServlet.service(SlingSafeMethodsServlet.java:345)
 at org.apache.sling.api.servlets.SlingSafeMethodsServlet.service(SlingSafeMethodsServlet.java:376)
 at org.apache.sling.engine.impl.request.RequestData.service(RequestData.java:533)        at org.apache.sling.engine.impl.filter.SlingComponentFilterChain.render(SlingComponentFilterChain.java:44)

The actual root cause of the issue is the workflow super user group configured in /apps/system/config/com.adobe.granite.workflow.core.WorkflowSessionFactory.config is not available in the system.     

cq.workflow.superuser=["admin","administrators","workflow-superuser"]
cq.workflow.workspace="crx.default"
adapter.condition="If\\\ the\\\ ResourceResolver\\\ is\\\ a\\\ JcrResourceResolver\\\ or\\\ a\\\ Session."
cq.workflow.models="/etc/workflow/models"
cq.workflow.instances="/etc/workflow/instances"
cq.workflow.job.retry=I"3"
granite.workflow.inboxQuerySize=I"2000"


The issue got resolved after creating the user group(workflow-superuser) in the system with the required workflow permissions.


Thursday, September 24, 2015

Taxonomy/Tag issue after upgrading to Adobe Experience Manager(AEM) 6.1

Taxonomy/Tag issue after upgrading to Adobe Experience Manager(AEM) 6.1

Taxonomy/Tags are used for search purpose. These tags are used by external search tool to provide the details.

Issue being discussed here is about the Meta tags not being displayed.


This issue is expected to be seen after upgrading the environment to Adobe Experience Manager(AEM) 6.1 version and the root cause is due to change in the user permission.

To resolve this issue provide the required permissions, go to Useradmin. Give permission (Read, Modify, Create, Delete, and Replicate) to /etc/tags folder for the group everyone.

Only Read access is sufficient for publisher instance.



Thursday, September 17, 2015

Upgrading AEM/Adobe CQ5 version 5.6.1 to AEM/Adobe CQ5 version 6.1

Upgrading AEM/Adobe CQ5 version 5.6.1 to AEM/Adobe CQ5 version  6.1



Wednesday, August 5, 2015

java.lang.RuntimeException: ConfigurationManagerImpl disabled : Adobe CQ5/Adobe AEM 6.1

java.lang.RuntimeException: ConfigurationManagerImpl disabled : Adobe CQ5/Adobe AEM 6.1

We are receiving the the following exception after upgrading Adobe CQ5/Adobe AEM 5.6.1 to Adobe CQ5/Adobe AEM 6.1.

org.apache.sling.engine.impl.SlingRequestProcessorImpl service: Uncaught SlingException - java.lang.RuntimeException: ConfigurationManagerImpl disabled

Because of this the components are not able fetch the configuration details and failed to render.

The root cause of the issue is ConfigurationManagerImpl OSGI component is not enabled(default it will be disabled for security).

The issue got resolved after enabling the same.

The following steps can be followed to enable ConfigurationManagerImpl.

Login to system console - http://localhost:4502/system/console/components
Search for ConfigurationManagerImpl



Click on configure
Select Enabled and Save the configuration.




Friday, July 3, 2015

Internationalization i18n labels are not displaying: Adobe CQ5/Adobe AEM

Internationalization i18n labels are not displaying: Adobe CQ5/Adobe AEM.

We were facing the issue with displaying  the ii18 labels in Adobe Experience Manager(AEM) pages, the key is getting displayed instead of the message.

<fmt:message key="login"/>

The key "login" is displayed as label instead of the message "Login".

The root cause of the issue is, the bundle "Apache Sling Internationalization Support (org.apache.sling.i18n)" is in resolved state.

The issue got resolved after restarting the "Apache Sling Internationalization Support (org.apache.sling.i18n)" bundle.




Wednesday, July 1, 2015

Programatically Set/Get the metadata of an Asset: Adobe CQ5/Adobe AEM

Programatically Set/Get the metadata of an Asset: Adobe CQ5/Adobe AEM

The Adobe Experience Manager(AEM) version referred here is 5.6.1

@Reference
private ResourceResolverFactory resolverFactory;

ResourceResolver resourceResolver =null;
try
{
String resourcePath = "/content/dam/geometrixx-outdoors/banners/adventure.jpg";
resourceResolver= resolverFactory.getAdministrativeResourceResolver(null);
   Resource res = resourceResolver.getResource(resourcePath);
   
   Resource metadataRes =res.getChild("jcr:content/metadata");
   ModifiableValueMap map = metadataRes.adaptTo(ModifiableValueMap.class);
     
   //set metadata
   map.put("dc:samplemetadata", "sample metadata");
   resourceResolver.commit();
     
   //get metadata  
   String metadata=map.get("dc:samplemetadata").toString();  
     
}catch(Exception e)
{

}finally
{
resourceResolver.close();
}



Dependency in pom.xml

<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.api</artifactId>
<version>2.4.0</version>
<scope>provided</scope>
</dependency>