AEM - Debugging Tips



1) To check the number of sessions held in memory ( read this article for more detailed analysis on dealing with unclosed sessions ), in windows, get CQ process id

Run the jmap command of jvm

                               jmap -histo:live <<pid>> | findstr CRXSessionImpl


2) To generate and check thread dumps, either use Threads tab of CQ5 Web Console http://localhost:4502/system/console or Jstack

Run the jstack command of jvm

                       jstack <<pid>> | findstr cq


3) To check active or expired sessions and remove them, access http://localhost:4502/system/console/tokenmgr, or access CRXDE Lite and remove the token nodes. eg. To check and remove the token nodes of admin user in a vanilla CQ, access http://localhost:4502/crx/de/index.jsp#/home/users/a/admin/.tokens


4) To debug a specific problem, enabling DEBUG for error.log (logging entire CQ) is not recommended as setting the log level to DEBUG, may result in error.log growing gigantic in minutes; instead create a logger for specific package, for example to debug query builder (/bin/querybuilder.json) and log the xpath query (logged with log.debug())

Try Chrome Developer Tools AEM  Plug-In or follow the below process...

             a) Access http://localhost:4502/system/console/slinglog

             b) Create a new logger for package, with level DEBUG, logging to logs\search.log

             c) Execute query builder with query http://localhost:4502/bin/querybuilder.json?path=/content/dam&p.hits=full&property=tiff:Make&property.value=Canon

             d) The xpath query logged in logs\search.log


5)  To enable DEBUG log level for Indexing (org.apache.jackrabbit.oak.plugins.index.AsyncIndexUpdate) create a new logger for oak packages, (thanks to Sammit Potade for the tip)

             a) Access http://localhost:4502/system/console/slinglog

             b) Create a new logger for packages org.apache.jackrabbit.oak.plugins.index,, org.apache.jackrabbit.oak.query, with level DEBUG, logging to logs\oak.log

             c) Create a oak index, /oak:index/styleNumber, in CRXDE Lite http://localhost:4502/crx/de


             d) Use ACS AEM Commons Oak Index Manager to perform index/reindex of property styleNumber - http://localhost:4502/etc/acs-commons/oak-index-manager.html 


6)  In AEM 6 by default, the password (rep:password) is stored as SHA-256

     To change the hashing algorithm to SHA-512, access http://localhost:4502/system/console/configMgr -> Apache Jackrabbit Oak UserConfiguration, change Hash Algorithm to SHA-512


7)  To check indexing bottle necks from the logs

grep "org.apache.jackrabbit.oak.plugins.index.AsyncIndexUpdate AsyncIndex (async) update run completed " error.log | grep -o  "[0-9]* s"| sort -n


8)  With, Sling uses TokenBasedAuthentication of Jackrabbit and the authentication is case-sensitive by default. For case insensitive login add

-DTokenCompatMode=true to JVM_OPTS in CQ startup scripts


9) To create new jcr namespaces (on publish) so that a transport user (not admin) can replicate content/assets (containing custom, project specific namespaces) from author to publish, provide jcr:namespaceManagement privilege on Repository to the user. For example, the user transporter in below picture was given jcr:namespaceManagement privilege


10)  In AEM <= 6.0 the compiled classes are placed in CRX /var/classes - http://localhost:4502/crx/de/index.jsp#/var/classes. To force recompile any jsp files, deleting the node in /var/classes helped; with AEM 61, the compiled class files are NOT placed in /var/classes any more, so to recompile jsps, use Felix Console - http://localhost:4502/system/console/slingjsp or to be 100% sure to the naked eye, follow these steps

             a. Stop bundle
             b. Search with keyword classes in CQ install folder <author>\crx-quickstart\launchpad\felix
             c. Delete generated java/class files from <author>\crx-quickstart\launchpad\felix\<bundleXYZ>\data\classes
             d. Delete generated java files from /var/classes in CRX (sightly generated java files are placed here)
             e. Restart bundle


11)  OSGI action when updating packages in AEM. Packages with SNAPSHOT in name have special meaning; SNAPSHOT packages are only for Dev environment. Thanks to Ian Boston for the tip

Current Version New Version Action
1.0.22 1.0.23 Install
1.0.22 1.0.23-SNAPSHOT Install
1.0.23 1.0.23-SNAPSHOT Ignore
1.0.23-SNAPSHOT 1.0.23-SNAPSHOT Install
1.0.23-SNAPSHOT 1.0.23-r231423423 Install
1.0.23-r231423423 1.0.23-r231423423 Ignore
1.0.23-r231423423 1.0.23-r231423424 Install (last digit 4 > 3)
1.0.23-SNAPSHOT 1.0.23-T1r231423423 Install
1.0.23-T1r231423423 1.0.23-T2r231423423 Install (Patch revision number - T2r > T1r)


12)  By default, only administrators can view all workflow instances; to add users/groups for administering workflows (view, terminate, monitor workflows created by other users), give necessary read/write permissions on /etc/workflow/instances and add user/group to Superuser of Adobe Granite Workflow Service - http://localhost:4502/system/console/configMgr/com.adobe.granite.workflow.core.WorkflowSessionFactory

No comments:

Post a Comment