Adding custom clientLibs on component dialog in AEM.
Check render condition is not valid
Run local AEM on https
Installing a SSL certificate to local AEM instance.
https://experienceleague.adobe.com/docs/experience-manager-learn/foundation/security/use-the-ssl-wizard.html#
How to create an experience fragment in AEM?
- Open AEM and navigate to the Assets console.
- Click on the Experience Fragments folder on the left side of the console.
- Click on the "Create" button at the top of the console and select "Experience Fragment" from the dropdown menu.
- Fill in the required fields in the "Create Experience Fragment" dialog box, including the XF's name, title, and description. You can also select a thumbnail image to represent the XF.
- Click on the "Create" button to create the XF.
- Once the XF has been created, you can begin authoring it by clicking on the "Open" button next to its name in the Assets console.
- The authoring mode for an XF is similar to the standard AEM authoring environment. You can add components and content to the XF, as well as define variations that can be used to tailor the XF for different audiences or use cases.
- Once you have finished authoring the XF, you can publish it to make it available for use in your AEM sites. To publish the XF, select it in the Assets console and click on the "Publish" button at the top of the console. You can choose to publish the XF as a draft or a final version, and select the channels or audiences that should have access to it.
- After the XF has been published, you can use it in your AEM sites by adding it as a component to a page or template. When the page or template is rendered, the XF will be displayed with its defined content and variations.
How to map AEM component with SPA React/Angular component
MapTo('jorvee/components/text')(Text, TextEditConfig);
export default MapTo('wknd-spa-react/components/text')(Text, TextEditConfig);
Reference
Bundle is NOT whitelisted in AEM
While using the loginAdministrative() method of SlingRepository class you might see an error "Bundle is not whitelisted". To get this method work we have to whitelist the bundle in OSGi configuration "Apache Sling Login Admin Whitelist" this helps us to defines which bundles can use SlingRepository.loginAdministrative().
Below is the code snippet of creating session using loginAdministartive method.
@Reference
private SlingRepository repository
Session session = repository.loginAdministrative(null);
Java SDK 11 required to run AEM as Cloud Service
We need Java 11 SDK to work on AEM as CS. If you try to run on a lower version of Java SDK then it will throw an error. below is the error which you will get when you try to run the AEM as a cloud service jar using Java 1.8
E:\aem-sdk>java -jar aem-sdk-quickstart-author-p4502.jarLoading quickstart properties: default
Loading quickstart properties: instance
java.lang.Exception: Quickstart requires a Java Specification 11 VM, but your VM (Java HotSpot(TM) 64-Bit Server VM / Oracle Corporation) reports java.specification.version=1.8
at com.adobe.granite.quickstart.base.impl.Main.checkEnvironment(Main.java:1046)
at com.adobe.granite.quickstart.base.impl.Main.<init>(Main.java:646)
at com.adobe.granite.quickstart.base.impl.Main.main(Main.java:981)
Quickstart: aborting
Cloud Manager timeout
While using the cloud manager to build and deploy the code on Adobe Experience Manager (AEM), the default waiting time at a step is 7 days. If we left the pipeline waiting at any step for more than 7 days then the pipeline automatically gets failed.
Cloud Manager Pipeline. Image Source Adobe Experience League
Reference
Difference between the Process Thumbnails and Create Thumbnail workflow steps in AEM
Workflow steps |
How to check registered sling models classes in AEM?
/system/console/status-slingmodels
Sling Models Inject Annotation Processor Factories
- com.day.cq.wcm.models.impl.injectors.StyleValueInjector
- com.day.cq.wcm.models.impl.injectors.StyleOrValueMapValueInjector
- com.adobe.acs.commons.models.injectors.annotation.impl.JsonValueMapValueAnnotationProcessorFactory
- com.adobe.acs.commons.models.injectors.annotation.impl.I18NAnnotationProcessorFactory
- com.adobe.acs.commons.models.injectors.annotation.impl.HierarchicalPagePropertyAnnotationProcessorFactory
- com.adobe.acs.commons.models.injectors.annotation.impl.ChildResourceFromRequestAnnotationProcessorFactory
- com.adobe.acs.commons.models.injectors.annotation.impl.SharedValueMapValueAnnotationProcessorFactory
- com.adobe.acs.commons.models.injectors.annotation.impl.AemObjectAnnotationProcessorFactory
- org.apache.sling.models.impl.injectors.BindingsInjector
- org.apache.sling.models.impl.injectors.ResourcePathInjector
- org.apache.sling.models.impl.injectors.RequestAttributeInjector
- org.apache.sling.models.impl.injectors.OSGiServiceInjector
- org.apache.sling.models.impl.injectors.SlingObjectInjector
- org.apache.sling.models.impl.injectors.SelfInjector
- org.apache.sling.models.impl.injectors.ChildResourceInjector
- org.apache.sling.models.impl.injectors.ValueMapInjector
Sling Models Implementation Pickers
- org.apache.sling.models.impl.ResourceTypeBasedResourcePicker
- org.apache.sling.models.impl.FirstImplementationPicker
Sling Models Injectors
- i18n - com.adobe.acs.commons.models.injectors.impl.I18nInjector
- style - com.day.cq.wcm.models.impl.injectors.StyleValueInjector
- stylevaluemap - com.day.cq.wcm.models.impl.injectors.StyleOrValueMapValueInjector
- json-valuemap-value - com.adobe.acs.commons.models.injectors.impl.JsonValueMapValueInjector
- hierarchical-page-property - com.adobe.acs.commons.models.injectors.impl.HierarchicalPagePropertyInjector
- child-resources-from-request - com.adobe.acs.commons.models.injectors.impl.ChildResourceFromRequestInjector
- script-bindings - org.apache.sling.models.impl.injectors.BindingsInjector
- valuemap - org.apache.sling.models.impl.injectors.ValueMapInjector
- resource-path - org.apache.sling.models.impl.injectors.ResourcePathInjector
- child-resources - org.apache.sling.models.impl.injectors.ChildResourceInjector
- request-attributes - org.apache.sling.models.impl.injectors.RequestAttributeInjector
- define-objects - com.adobe.acs.commons.models.injectors.impl.AemObjectInjector
- osgi-services - org.apache.sling.models.impl.injectors.OSGiServiceInjector
- sling-object - org.apache.sling.models.impl.injectors.SlingObjectInjector
- self - org.apache.sling.models.impl.injectors.SelfInjector
How to search and get list of all pages of a given template in AEM?
Adobe experience manager is a powerful content management tool that provides ample options to explore and manage the content. In this post, we are going to see how to search and get all the pages from AEM which are created using a given template.
The detail required to execute this process.
Project path: Path of the directory where we would want to search the pages. e.g. /content/sample/en/en_us
Template path: Path of template. e.g. /apps/sample/templates/press
Now we have prerequisite handy with us, let's move to the execution.
Step 1: Go to the below mention URL. Adjust the domain according to your domain name.
http://localhost:4502/libs/cq/search/content/querydebug.html
Step 2: Put the following query in the "Query Builder Debugger" section
type=cq:Page
path=/content/sample/en/en_us
1_property=jcr:content/cq:template
1_property.value=/apps/sample/templates/press
p.limit=500
In the above query; type cq:Page will include the nodes that have type cq:Page. Other than that nodes will get excluded from the script. after that path under that, we want to search the pages. Then after the name of the property and property value that will be a path of the template for which we are looking.
The last line p.limit is to set the limit of the results. We may set higher to get all the results at once on the screen.
AEM Query Builder Debugger |
Now click on the search button. After that query builder will execute the query and show the result on the right side of the page under the results section. Below is the screenshot.
Now click on the JSON QueryBuilder Link and get the JSON of the result which later you can convert into a CSV/XLS for future references.
References:
How to find or count all pages in AEM project?
SELECT * FROM [cq:Page] AS page WHERE ISDESCENDANTNODE(page ,"/content/project")Below is the screenshot of the result and query execution steps. You may replace the path with your own project path e.g. /content/project
Count of pages in AEM project |
Analyze AEM thread dumps
To retrieve and get the thread dumps from a running AEM instance, open Apache Felix console then go to status >> Apache Felix Thread Dump or directly use this thread dump URL. https://localhost:4502/system/console/status-threaddump
Here we can see many download options(highlighted in below screenshot), using these download options we can download the thread dumps according to our need or just pick and copy the few threads dump from the console itself.
Image 1: Apache Felix Thread Dump console in AEM |
This is how we can fetch and get the thread dump from AEM system.
Now to analyze those thread dumps we have a brilliant online tool fastThread available, using this tool we can easily analyze the thread dump.
1. Open the fastthread.io/
2. Under the Upload Thread Dumps option, we have the privilege to either use the upload or raw option.
Upload: In this case, we have to upload a file of thread dumps.
Raw: Just need to paste the content(thread dumps) in the text filed.
3. Now click on the analyze button. As soon as you clicked on the analyze button it will start analysis on our thread dumps.
After successful analysis, it will generate a report which will look like as below.
Image 2: fastThread thread analyzer tool |
In the left sidebar, we could see all headings of the report. Check all part of this report and take the right and preventive action to fix the thread or high CPU consuming issue.
References:
1. Take thread dumps from a JVM
Setup local dispatcher server | AEM as cloud service
In this article we are going to learn how to setup AEM cloud service dispatcher server on local machine.
Prerequisite:
1. Download the docker from Docker official site for our operating system. >> https://www.docker.com/products/docker-desktop and install the docker. Note: We need administrator privileged to run this installer, since this docker installer will change some BIOS settings in operating system.
2. Download latest AEM-SDK from Adobe software distribution library. https://experience.adobe.com/#/downloads/content/software-distribution/en/aemcloud.html
Lets start the local dispatcher setup now:
Step 1: Start docker, make sure our docker is active and running.
Step 2: Create a folder "C:\Users\<user>\aem-sdk\dispatcher". Then extract the file "aem-sdk-dispatcher-tools-<version>-windows.zip" here. This will extract three folders:
- bin
- src
- docs
Note: These all folder should direct child of dispatcher folder.
Step 3: Open the CLI (cmd) at open directory "C:\Users\<user>\aem-sdk\dispatcher"
Now run the command bin\validator full -d out srcC:\Users\<user_name>\aem-sdk\dispatcher>bin\validator full -d out src
Cloud manager validator 2.0.21
2020/08/07 18:31:20 No issues found
bin\docker_run out host.docker.internal:4503 8080
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | C:\Users\rashidjorvee\aem-sdk\dispatcher>bin\docker_run out host.docker.internal:4503 8080 Required image not found, trying to load from archive... d9ff549177a9: Loading layer [==================================================>] 4.671MB/4.671MB 14c93ed9ebdc: Loading layer [==================================================>] 7.123MB/7.123MB cf0d60dcd2e9: Loading layer [==================================================>] 1.848MB/1.848MB 214f54e148db: Loading layer [==================================================>] 109.1kB/109.1kB 5931f9345e57: Loading layer [==================================================>] 3.584kB/3.584kB 5ad19feebed3: Loading layer [==================================================>] 5.12kB/5.12kB 21a29c76732d: Loading layer [==================================================>] 4.096kB/4.096kB 860d3c46b038: Loading layer [==================================================>] 3.584kB/3.584kB Loaded image: adobe/aem-ethos/dispatcher-publish:2.0.23 Running script /docker_entrypoint.d/10-check-environment.sh Running script /docker_entrypoint.d/20-create-docroots.sh Running script /docker_entrypoint.d/30-wait-for-backend.sh Waiting until host.docker.internal is available host.docker.internal resolves to 192.168.65.2 Running script /docker_entrypoint.d/40-generate-allowed-clients.sh Running script /docker_entrypoint.d/50-check-expiration.sh Running script /docker_entrypoint.d/60-check-loglevel.sh Running script /docker_entrypoint.d/70-check-forwarded-host-secret.sh Starting httpd server [Fri Aug 07 13:12:16.706522 2020] [:notice] [pid 1:tid 140172533533576] ModSecurity for Apache/2.9.2 (http://www.modsecurity.org/) configured. [Fri Aug 07 13:12:16.706805 2020] [:notice] [pid 1:tid 140172533533576] ModSecurity: APR compiled version="1.6.3"; loaded version="1.6.3" [Fri Aug 07 13:12:16.706827 2020] [:notice] [pid 1:tid 140172533533576] ModSecurity: PCRE compiled version="8.42 "; loaded version="8.42 2018-03-20" [Fri Aug 07 13:12:16.706837 2020] [:notice] [pid 1:tid 140172533533576] ModSecurity: LIBXML compiled version="2.9.8" [Fri Aug 07 13:12:16.706844 2020] [:notice] [pid 1:tid 140172533533576] ModSecurity: Status engine is currently disabled, enable it by set SecStatusEngine to On. [Fri Aug 07 13:12:16.875893 2020] [mpm_worker:notice] [pid 1:tid 140172533533576] AH00292: Apache/2.4.43 (Unix) Communique/4.3.4-20200624 mod_qos/11.63 configured -- resuming normal operations [Fri Aug 07 13:12:16.876090 2020] [core:notice] [pid 1:tid 140172533533576] AH00094: Command line: 'httpd -d /etc/httpd -f /etc/httpd/conf/httpd.conf -D FOREGROUND -D ENVIRONMENT_DEV' 172.17.0.1 "localhost:8585" - [07/Aug/2020:13:12:42 +0000] "GET / HTTP/1.1" 302 - "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36" [07/Aug/2020:13:12:42 +0000] "GET /index.html HTTP/1.1" 302 none [publishfarm/0] 24ms "localhost:8585" 172.17.0.1 "localhost:8585" - [07/Aug/2020:13:12:42 +0000] "GET /content.html HTTP/1.1" 404 196 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36" [07/Aug/2020:13:12:42 +0000] "GET /content.html HTTP/1.1" - blocked [publishfarm/-] 1ms "localhost:8585" [07/Aug/2020:13:12:43 +0000] "GET /favicon.ico HTTP/1.1" 404 none [publishfarm/0] 39ms "localhost:8585" 172.17.0.1 "localhost:8585" - [07/Aug/2020:13:12:43 +0000] "GET /favicon.ico HTTP/1.1" 404 235 "http://localhost:8585/content.html" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36" [Fri Aug 07 13:13:28.608851 2020] [mpm_worker:notice] [pid 1:tid 140172533533576] AH00296: caught SIGWINCH, shutting down gracefully 172.17.0.1 "-" - [07/Aug/2020:13:13:34 +0000] "-" 408 - "-" "-" |
del -/Q out && bin\validator full -d out <path of the dispatcher source files in your project>
e.g. del -/Q out && bin\validator full -d out E:\aem\aemcloudmanager\aem-cloud-manager-set-up\dispatcher\src
References:
Pause option in AEM replication agent queue
At some point we need to stop the replication from AEM author to publisher for sometime or few minutes, so that no content get published from author to publisher instance. This may we need to handle the maintenance window or stop accepting new content from authors. So question here is how we can do this without disabling the AEM replication queue.
How to pause the replication agent queue?
Out of the box AEM replication agent queue have an option "pause", using that pause option we could stop the replication. When you will pause the queue then all content which will get published by authors during that time frame will be enlist in the queue but those will not get processed. Pause option will only pause your queue but your replication queue will be still enabled and active.
Active AEM replication queue:
Paused AEM replication queue:
Points to be remember:
- When we will restart our instance then this paused status will be override and we will find queue is active.
- By default it will pause for an hour.
Hope this help you to understand the pause option and its role in AEM replication queue.
References:
AEM as cloud service, /apps and /libs directories are in ready only mode
References:
AEM Cloud Service deployment issue | Packages shouldn't mix mutable and immutable content
Mutable
/content , /conf , /var , /etc , /oak:index , /system , /tmp , etc. are all mutable areas of AEM project, it means they can be changed at runtime.Immutable
Issue Description
How to search the content only from the specified directory using AEM query builder?
path=/content/dam/we-retail/en/features
path.flat=truetype=dam:Assetfulltext=cart
Filters definition:
- path=? // On which path this query will perform the search operation.
- path.flat=true // will look the content only in the specified directory.
- fulltext=? //name or keyword which you are searching.
find direct children using query builder |
Query tree + URLs
ROOT=group: [{fulltext=fulltext: fulltext=cart}{path=path: path=/content/dam/we-retail/en/features, flat=true}{type=type: type=dam:Asset}]
XPath query to find the direct child in a directory
/jcr:root/content/dam/we-retail/en/features/element(*, dam:Asset)[(jcr:contains(., 'cart'))]
JSON response
{"success": true,"results": 1,"total": 1,"more": false,"offset": 0,"hits": [{"path": "/content/dam/we-retail/en/features/cart.png","excerpt": "/content/dam/we-retail/en/features/cart.png","name": "cart.png","title": "cart.png","lastModified": "2016-06-06 16:26:05"}]}
How to export the list of users from AEM?
Prerequisite:
Step 1: Open the URL <domain>/miscadmin#/etc/acs-commons/exporters
Go to Tools >> acs-commons >> Exporters from left side rail. Below is the screenshot of steps.
- Click on the Exporter folder
- Click on New >> New Page
- Create a page with any title using the default selected template(User to CSV Exporter).
- Click on create button.
Export User list in AEM |
Custom user properties |
User profile section in CRXDE |
Step 3: Now Select the group membership the way which you want to export. Using Only Include Users by Group Membership option.
- Direct Membership : Only the direct member of groups.
- Indirect Membership: Only Indirect member of groups, means a group which is member of another group.
- Direct and Indirect Membership: Both direct and indirect membership.
Only Include Users by Group Membership option |
Download User CSV Report |
You may also save the configuration for later use using the save configuration button.
References:
Custom Dispatcher flush rule setup | acs commons
Create a custom dispatcher flush rule for your content, which an author can trigger using UI, without any involvement of developer and DevOps person. This is a single click activity for an author to invalidate the dispatcher cache.
For this ACS-commons provide a powerful which we need to configure in our AEM author instance. Here are the steps to set up the custom dispatcher flush using acs-commons.
Step 1: Log in to AEM instance.
Step 2: Download the acs-commons latest version from acs official site and install the acs-commons package in your AEM instance using AEM package manager [http://localhost:4502/crx/packmgr].
Step 3: After the successful installation of acs-commons, browse to AEM tools section. http://localhost:4502/miscadmin.
Step 4: Now create a dispatcher flush page to set up your dispatcher configuration. Below is the screenshot.
1. Click on the Dispatcher Flush directory from the left rail.
2. Click on the new button from the menu bar, and select the option, New Page. As soon as you click on the New Page option a new window will appear. As highlighted below.
3. Put the Title and Name for the page. e.g. custom dispatcher flush
4. Click on the create button.
5. This will create a custom-dispatcher-flush page under the Dispatcher Flush directory.
Custom dispatcher flush |
1. Flush method - We need to specify whether we want to invalidate the caching or completely delete the caching from the dispatcher server.2. Paths to flush - We will list all the path and pages which we want to invalidate or delete from the dispatcher server.
Step 7: Now we have to enable the Dispatcher Flush agent queue on AEM author. [http://localhost:4502/etc/replication/agents.author/flush.html]. If the AEM instance is already configured with dispatcher then we need not do anything extra in this case, just verify the Dispatcher Flush agent from the above-mentioned path.
In case the dispatcher Flush is not setup then configure the following in properties in the configuration setting.
1. Edit the Dispatcher Flush settings. Click on the Edit button from the below screen.
2. Enabled - Check enabled option.
3. Move to the transport tab and set the following
a. URI - URL of the dispatcher server.
b. User - a transport user name
c. Password - password of transport user
Our dispatcher configuration is set, now using the Test Connection option we can verify the configuration setting and ensure everything is fine.