Sunday, 23 September 2018

Upgrade AEM 6.2 to AEM 6.4

AEM instance can be upgraded to 6.4 version in two ways.

  1. New AEM 6.4 setup
  2. In-place upgrade
Let's c In-place upgrade process.

In-place upgradation Process:

  1. Start you AEM 6.2 instance.
  2. Check all consoles are working fine.
  3. Remove all custom code and configs.
  4. Check “quickstart.properties” file is present under /crx-quickstart/conf. If not, copy from other instance and paste it in above location.
  5. Run offline compaction to reduce repository size. Check how to run offline compaction.
  6. Goto packageshare and download the package 

    pre-upgrade-package-cq62-1.2.zip


  7. Navigate to package manager and install the 

    pre-upgrade-package-cq62-1.2.zip

  8.  Once package is installed, navigate to OSGI Config Manager. Search for "preupgrade". Look for com.adobe.aem.upgrade.prechecks.mbean.impl.PreUpgradeTasksMBeanImpl.
Lets see what these are parameters do:
VersionPurge: This can be used to purge page versions.
GenerateBundlesListFileTask: List of bundles will be checked and placed in some path. This path can be found in your log.
DisableReplication: Disable replication agents
WorkflowPurgeTask:  Purge workflow. I not used while performing upgrade as I don’t have any workflow purge settings.
com.day.cq.audit.impl.AuditLogMaintenanceTask: Audit log in logger.
NOTE: If you run any task which you not configured then pre-upgrade task gets fail.
10.Once all necessary settings are added , open JMX console and select PreUpgradeTasks”.

11. Open error.log and check below entries in logs

23.09.2018 11:30:55.155 *INFO* [sling-threadpool-afcaa079-0115-490c-885f-2041bf40c356-(apache-sling-job-thread-pool)-1-Pre Upgrade Tasks Queue(com/adobe/aem/preupgrade/job/RunAllPreUpgradeTasks)] 
com.adobe.aem.upgrade.prechecks.tasks.impl.RunAllPreUpgradeTasksImpl com.day.cq.wcm.core.impl.VersionPurgeTask task finished running successfully.
...............................................................................................................................................................................
..............................................................................................................................................................................
23.09.2018 11:31:05.455 *INFO* [sling-threadpool-afcaa079-0115-490c-885f-2041bf40c356-(apache-sling-job-thread-pool)-1-Pre Upgrade Tasks Queue(com/adobe/aem/preupgrade/job/RunAllPreUpgradeTasks)] 
com.adobe.aem.upgrade.prechecks.tasks.impl.RunAllPreUpgradeTasksImpl WorkflowPurgeTask task finished running successfully.
...............................................................................................................................................................................
..............................................................................................................................................................................
23.09.2018 11:31:16.118 *INFO* [sling-threadpool-afcaa079-0115-490c-885f-2041bf40c356-(apache-sling-job-thread-pool)-1-Pre Upgrade Tasks Queue(com/adobe/aem/preupgrade/job/RunAllPreUpgradeTasks)] 
com.adobe.aem.upgrade.prechecks.tasks.impl.RunAllPreUpgradeTasksImpl GenerateBundlesListFileTask task finished running successfully.
...............................................................................................................................................................................
..............................................................................................................................................................................
23.09.2018 11:31:21.229 *INFO* [sling-threadpool-afcaa079-0115-490c-885f-2041bf40c356-(apache-sling-job-thread-pool)-1-Pre Upgrade Tasks Queue(com/adobe/aem/preupgrade/job/RunAllPreUpgradeTasks)] 
com.adobe.aem.upgrade.prechecks.tasks.impl.RunAllPreUpgradeTasksImpl DisableReplicationAgentsTask task finished running successfully.
...............................................................................................................................................................................
..............................................................................................................................................................................
23.09.2018 11:31:21.229 *ERROR* [sling-threadpool-afcaa079-0115-490c-885f-2041bf40c356-(apache-sling-job-thread-pool)-1-Pre Upgrade Tasks Queue(com/adobe/aem/preupgrade/job/RunAllPreUpgradeTasks)] 
com.adobe.aem.upgrade.prechecks.tasks.impl.RunAllPreUpgradeTasksImpl RunAllPreUpgradeTasks task finished running successfully.
12. Stop AEM 6.2 server and remove files under crx-quickstart/launchpad/installer.
13. Place your AEM 6.4 jar on the same place where AEM 6.2.jar placed.
14. Run the below command:
D:\CQ5\CQ5\AEM6.2>java -Xmx4096m -jar AEM_6.4_Quickstart.jar -unpack
Once done successfully we will be getting below message
Quickstart files unpacked, server startup scripts can be found under //crx-quickstart/bin

15. Run below command to change repository to segment tar. 

D:\CQ5\CQ5\AEM6.2>java -Xmx4096m -jar AEM_6.4_Quickstart.jar -v -x 
crx2oak -xargs - -load-profile segment-no-ds

23.09.2018 12:17:34.203 INFO c.a.g.c.e.MigrationRunner: migration completed

 __   __         __        ___ ___  ___  __

/  ` /  \  |\/| |__) |    |__   |  |__  |  \

\__, \__/  |  | |    |___ |___  |  |___ |__/

16. Start AEM 6.4.
17. It starts new segment tar repository and also perform re-indexing. Grab some coffee and wait till you see the below message in log.

org.apache.jackrabbit.oak.plugins.index.IndexUpdate Reindexing completed

18. Navigate to product information console to see the product version.


Thursday, 14 June 2018

RedirectTarget property is not working in AEM 6.2

I tried to redirect a page to another using redirectTarget page property in wcmmode=disabled in author instance.

This redirectTarget property is working on Geomertrixx site and not on we-retail site.

Root Cause:
Geomertrixx site is created using template /libs/foundation/components/page and we-retail site is created using wcm/foundation/components/page.

Page component under foundation path is having code to redirect to another page, where as page component under wcm is not having code to redirect. In page.jsp we have code to redirect response.sendRedirect(redirectPath); which we don't have it in page.html.

Try these:
  • Try running AEM on publish runmode. 
  • Try creating a page with sling:resourceType: foundation/components/redirect. 

Saturday, 9 June 2018

Access ClientLibs under apps folder through ClientLibraryProxyServlet

AEM provides ClientLibs feature to organize JS and CSS. Clientlibs can be created as 

  1. Approach 1: Place all files under /etc/designs/{project}/clientlibs path.
  2. Approach 2: Creating clientlibs under each component. Disadvantage with this approach is it increases number of calls to load clientlibs throuhout the page. This doesn't follow best practices as CSS will not be loaded in head section.
  3. Approach 3: Place clientlibs under /apps/project/. 
/apps folder is restricted to access by dispatcher. So we need to enable ClientLibraryProxyServlet  to access the clientlibs from apps folder.  Below are the steps to enable clientLibrary Proxy.

  • Create a new client library under /apps/... with new category. Let's say myapp.all
  • Add a embed property and  include all modular component library. (firstcomp,secondcomp)
  • Add boolean allowProxy = 'true'
  • On the headlibs.jsp include the above 
  • Then the clientlib will then be proxied via  there by passing access control set on the clientlib.

    • Configure dispatcher.any to allow for /etc.clientlibs/

Friday, 25 May 2018

Rename JSession Cookie name in AEM

JSessionID cookie name can be renamed by following below steps.


1. Go to http://localhost:4502/system/console/configMgr/org.apache.felix.http and log in as admin. We can do this by using an osgiConfig node for specific runmmode.

2. Change the value for Session Cookie Name (org.eclipse.jetty.servlet.SessionCookie))

3. Changing this property will cause AEM to restart itself (< 2 seconds)