Friday, July 29, 2016

AEM6 | Swedish/ Non English Characters not displaying on page

If you are facing issue with display of Non-English characters in your site/ page then you can check following things-


1. Change Request Parameter Encoding 

a. Go to OSGi configuration console (http://localhost:4502/system/console/configMgr) and search for "Apache Sling Request Parameter handling" Service
b. Change Encoding to "UTF-8"



c. If changing this does not work then try restarting AEM after this change.
d. In worst case, you can apply the encoding to the property directly:
       
       new String(str.getBytes("ISO-8859-1"),"UTF-8"); Where str is the property string

2. Set Character Encoding to "UTF-8" in Ajax and Servlets.

Thursday, July 28, 2016

AEM Troubleshooting/ Useful Links

Sharing few utility tools/ links-

1. To find the generated java files in AEM6.1

Generated JSP JAVA files used to be at -  /var/classes location but AEM6.1 on wards it's no longer present there. This is due to change of repository ClassLoader, now it uses FSClassLoader (File System ClassLoader) for better performance and throughput.

Generated JSP java files are located at- [AEM_INSTALL_DIR]/crx-quickstart/launchpad/felix/bundle[BUNDLE_ID]/data/classes



Source: For details read following article - http://labs.6dglobal.com/blog/2015-06-23/new-apache-sling-fs-classloader-console/

2. Dependency finder- 

Use the following link to know the maven dependency for a package-http://localhost:4502/system/console/depfinder

3. Rebuilding clientlibs-

Use following link to rebuild Client Libraries for CSS and JS-
http://localhost:4502/libs/granite/ui/content/dumplibs.rebuild.html?rebuild=true


4. Reecompile JSP

Use following link to recompile all generated JSP Java files-
http://localhost:4502/system/console/slingjsp 

5. Auto Deploy UI Package


mvn clean install -PautoInstallPackage

For publish-  mvn clean install -PautoInstallPackagePublish -Daem.publish.host=localhost -Daem.publish.port=4503

6. Auto Deploy Java Package


mvn clean install sling:install


7. Accessing repository through WebDav for Bulk uploads

Following link describes detailed steps on how to access the AEM repository through WebDav-
http://labs.6dglobal.com/blog/2016-05-11/webdav-transfers/

8. AEM Companion App:

Alternative to WebDav you can use AEM Companion App for Desktops. It is very helpful for managing DAM Assets directly from your system. Here is the link for documentation-
https://docs.adobe.com/docs/en/aem/6-1/administer/integration/companion-app.html

9. Grunt Integration with AEM-Maven Project

http://labs.6dglobal.com/blog/2016-07-21/using-grunt-in-aem-maven/

10. Monitoring/ Reporting

Go to- http://localhost:4502/miscadmin#/etc/reports. Following tools are available- 

 11. Bulk Editor/ Searching pages based on Parameters

12. Checking log files

system/console/slinglog/tailer.txt?tail=500&name=/logs/error.log

Tuesday, July 26, 2016

SDI Integration to render dynamic content through web server

Below are the steps to integrate Sling Dynamic Include in your project:

1. Download the source code from- https://github.com/Cognifide/Sling-Dynamic-Include and put it in a folder
2. Run a mvn clean install command in the folder containing pom.xml
3. Go to the target folder and pick the created jar file (so generated SDI jar)
4. Install the bundle in AEM OSGi or placeit in your project install folder
5. Follow the steps given at- https://github.com/Cognifide/Sling-Dynamic-Include

Changing Default AEM login background image

Default AEM login screen is rendered using the login component located at - /libs/cq/core/components/login path. If you need to change anything in login UI, you need to overlay this structure and make changes as desired. One such use case is changing the background image of the default login page.

Look at the following file in CRXDE Lite - /libs/cq/core/components/login/login.jsp

You will see that the background image is defined here-

If you just want to change the background image then overlay the path - /libs/cq/core/content/login/bg/background.png for your project. and place your background.png in the overlayed location in /apps/.

Thursday, July 21, 2016

AEM6 | Export Users/ Groups with ACL Permissions

If you need to transfer users and groups in  AEM from one server to another or from one AEM instance to another then you need to create a package of users/groups along with rep:policy nodes. It is important to include rep:policy nodes as the permissions are stored at the individual target nodes instead of group/ user node. We need to Include all individual rep:policy nodes where you have given access to groups.

If users are included in the package then :
Add Exclude rule to users for token: /home/users/.*/.tokens

The Recommended option is to use acs-aem-commons tool to create a separate ACL package to migrate the ACLs. This utility picks the rep:policy nodes automatically so we don't have to worry about it.

Follow the below steps :

1. Create the ACL package as shown below -




2. Configure the ACL package

Once package is created open the ACL package page and configure it for groups and users definition.
While configuring package, it is important that you select all the principles i.e. users or groups which you want to export under "Principal Names". You can keep the "Include Patterns" field blank to ensure that all nodes which have rep:policy node are included automatically. You don't have to include them selectively because doing that may be cucumbersome and  there are chances you may miss few entries.


You need to check "Include principles" option if the selected principals do not exist in target environment otherwise you can keep it unchecked.

Set ACL Handling to overwrite (or Merge**)
**In case the "overwrite" does not work for you, try with "merge" option.

3. Install the package in destination AEM instance

Note :- I suggest to perform/ verify this in a test instance first. Ensure you take back of existing User/group definitions before you upload the package in destination AEM instance.

Troubleshooting: 

Once you have installed the package in destination, cross verify the users, groups and permission. Make changes in your filter definition in Step 1 as required if you see any issues and build/ install again.
In case the permissions does not reflect properly, check if you have given the permission at root level i.e. selecting the check all option at the top. Sometimes this give issue so instead of giving permissions at root level, give permissions at sub root level i.e. /content, /etc, /home, /libs etc.


Sunday, July 17, 2016

AEM6 | Compatible Audio Codec for MP4 video

If you want to support mp4 video in AEM then you need to add "libfdk-aac" as audio codec profile in AEM . Just install "libfdk-aac" encoder with FFMPEG. This encoder provides "AAC" audio codec which runs by default on IE , Chrome and Safari browser.

Thursday, July 7, 2016

Performance Tuning in AEM6


1. Tuning the Sling Job Queues
The bulk upload of large assets may be very resource intensive. By default the number of concurrent threads per job queue is equal to the number of CPU cores, which may cause an overall performance impact and high java heap consumption.  It is recommended to not exceed 50% of the cores. To change this value, go to : http://<host>:<port>/system/console/configMgr/org.apache.sling.event.jobs.QueueConfiguration and set queue.maxparallel to a value representing 50% of the CPU cores of the server hosting your AEM instance (eg. for 8 CPU cores, set the value to 4). 

2. Create custom oak indexes for all frequently used search queries.
a) Analyze slow queries
b) Create the custom indexes under the oak:index node for all search properties
c) For each custom Lucene-based index, try to set includedPaths
d) Make use of guessTotal when querying large data sets in the application code.
e) Cache the search results JSON using a selector-based URL approach

Following links may help-
Oak index generator utility: will generate an index definition from a search query

Granite query performance monitor:

Granite search index manager:

Search index config docs:

Another useful tool for search index developing and debugging:

3.  JVM parameters
Prevent expansive queries from overloading the systems:-
-Doak.queryLimitInMemory=500000 (see also the Oak documentation)
-Doak.queryLimitReads=100000 (see also the Oak documentation)
-Dupdate.limit=250000
-Doak.fastQuerySize=true

4. Lucene index configuration:
Open /system/console/configMgr/org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexProviderService and
enable CopyOnRead
enable CopyOnWrite
enable Prefetch Index Files

5.  Externalize the Data Store
If you are using AEM Assets or have an AEM application that heavily uses binary files then it is recommended to use an external datastore. 

6. TAR off-line compaction only
As per Adobe on line compaction provides high-performing and healthy AEM environment but may cause rapid repository growth. Currently Adobe currently recommends to use the offline compaction, via the oak-run tool as documented under http://docs.adobe.com/docs/en/aem/6-0/deploy/upgrade/microkernels-in-aem-6-0.html#Maintaining the Repository

7. Disable Link Checker
If your project requirement does not need checking links on your pages then disable the link checker option from OSGi console-



Otherwise, follow the below link to figure out if it is causing any issue-

8. Settings for windows servers
If you are using windows server then look at the following link to figure out if any extra thing is required-
https://helpx.adobe.com/experience-manager/kb/high-memory-usage-aem-6.html

9. Avoid AEM crash during large asset upload
Follow the below link - https://helpx.adobe.com/experience-manager/kb/cqbufferedimagecache-consumes-heap-during-asset-uploads.html

10. IE Specific Tuning
If you support authoring in IE then following article may help you-
http://aem6solutions.blogspot.in/2016/06/aem6-image-upload-issue-in-internet.html


CDN | Clearing Cloudflare cache

In order to clear Cloudflare cache automatically via code, follow below steps: 1. Develop Custom TransportHandler Develop a custom Trans...