AEM6 + Mongo Minimal Setup

Posted on Tuesday, July 22, 2014 By

With the release of AEM 6.0, clustering has been rethought in the form of Apache Jackrabbit “Oak” and the introduction to the concept of microkernels. The initial microkernel that supports clustering uses MongoDB (v. 2.6+) for persistence. This post will provide a real working example of a minimal authoring cluster using a fault-tolerant MongoDB microkernel.

If I receive enough demand, I can also post a production quality MongoDB setup.

What you’ll need:

  • MongoDB installed
  • AEM 6.0 quickstart jar
  • Oracle JRE 1.7

The examples provided were tested using an OS X host but should be compatible on Windows as well as other Unix hosts.

Prep Work

  1. Install the MongoDB binaries
    (I used homebrew: sudo brew install mongodb)
  2. Install the Oracle JDK/JRE v 1.7 (if you haven’t already)
  3. Create a directory for housing your mongo data. I used “aem6_cluster”.
  4. Inside that directory, create these directories: node0,node1,arb0
    The two node directories will be the data directories for two members of a replica set. The arb directory is the data directory for an arbiter.
  5. From the main cluster directory, create another folder named “author”.
  6. Copy your aem 6 quickstart jar and license file to that directory. (Rename the quickstart to this if needed: aem6-author-p4502.jar)

MongoDB Logo

MongoDB setup

  1. From the main cluster directory run this mongo command (from terminal or command prompt):
     mongod --dbpath node0/ --replSet aem6
  2. Enter the mongo util in another terminal window:
  3. Initialize the replica set named in step 7:
     rs.initiate(rsconf = {_id: "aem6", members: [{_id: 0, host: "<hostname>:27017"}]})
  4. After the command is issued, it should return a json response with “ok”: 1. Keep this terminal window open.
  5. From the main cluster directory run this mongo command (from a new terminal or command prompt):
     mongod --dbpath node1/ --replSet aem6 --port 27018
  6. Back in the mongo util window that we kept open, issue this command to add the new node to the replica set:
  7. Once again, if the command executes correctly you should get a json response with “ok” : 1. Keep this window open (again).
  8. From the main cluster directory run this mongo command (from a new terminal or command prompt):
     mongod --port 27019 --dbpath arb0 --replSet aem6
  9. Back in the mongo util window that we kept open, issue this command to add this new node as an arbiter:

At this point we have a clean mongo replica set with 3 members. There should be a PRIMARY and SECONDARY with an aribter node to break up any ties for voting who is the PRIMARY. The two nodes provide minimal redundancy. If one goes down, the other takes over. If both go down, you’re up a creek.

AEM Logo

AEM 6 startup

From the author directory, issue this command:

 java -XX:MaxPermSize=512M -mx4g -jar aem6-author-p4502.jar -r crx3,crx3mongo -Doak.mongo.uri=mongodb://<hostname>:27017,<hostname>:27018

AEM should install and replicate automatically to the mongo nodes. Installation on pretty quick SSD-based mac takes less that 5 minutes (results may vary).

You can now repeat this process on any number of AEM instances as long as they are running on separate ports. Each AEM instance will be active+active in the cluster.

Note the run modes: crx,crx3mongo. The JVM settings can be left out – I just like to dedicate a bit more RAM.

Mongo Notes

To test out the fault tolerance, just ctl+c the mongo instance and watch the AEM driver switch to the elected PRIMARY.

Mongo replica sets must have an odd number of members. An arbiter is not required, but it allows you to have nicely divisible replica sets.

1:00 PM Permalink

Static multi-image component with image preview

Posted on Wednesday, November 27, 2013 By

I recently got a requirement in which I had to build a component in which the user can Drag and Drop 2 main images (e.g.: hero) and 3 sub images ( icons,buttons,logos etc). The main requirement was being able to preview these images while the author is creating content for that page.

I got it working after few trials and I am sharing the same.

Environment: CQ561

1. Create a single image component extending the OOTB (xtype=’html5smartimage’) image component. This should be fairly simple and if you need any information on this leave a comment and I can help.

Screen Shot 2013-11-27 at 4.37.12 PM


2. Now create another tab in your component structure by copy/pasting your current working image cq:Panel. For E.g.: in my case I copied /apps/blog/components/content/hero/dialog/items/items/imagetab1 and pasted it under /apps/blog/components/content/hero/dialog/items/items/ to create /apps/blog/components/content/hero/dialog/items/items/imagetab2

Screen Shot 2013-11-27 at 4.42.23 PM


3. Next to avoid confusion I also renamed the image cq:Widget at /apps/blog/components/content/hero/dialog/items/items/imagetab2/items/image to /apps/blog/components/content/hero/dialog/items/items/imagetab2/items/image4

Screen Shot 2013-11-27 at 4.44.59 PM


4. Now we will have to update the properties under image4 cq:Widget (/apps/blog/components/content/hero/dialog/items/items/imagetab2/items/image4) to make this work.


table { }td { padding-top: 1px; padding-right: 1px; padding-left: 1px; color: black; font-size: 12pt; font-weight: 400; font-style: normal; text-decoration: none; font-family: Calibri,sans-serif; vertical-align: bottom; border: medium none; white-space: nowrap; }

Property Name New Value
cropParameter ./image4/imagecrop
fileNameParameter ./image4/fileName
fileReferenceParameter ./image4/fielReference
name ./image4/image4file
rotateParameter ./image4/imageRotate

Screen Shot 2013-11-27 at 5.12.56 PM


5. Now when you go back to your content page you should have 2 different tabs and both having the image drag and drop functionality. You can extend this concept for more images as long as you make sure the properties are updated correctly for the image cq:Widget.

Screen Shot 2013-11-27 at 5.19.22 PM                                            Screen Shot 2013-11-27 at 5.19.11 PM

6:28 PM Permalink

Installing AEM from command line without sample content (Geometrixx)

Posted on Wednesday, November 27, 2013 By

When you install a new instance of Adobe Experience Manager a bunch of content is provided as Sample content. By sample content I am referring to the Geometrixx sites (Geometrixx, Geometrixx Mobile, Geometrixx Outdoors and Geometrixx Outdoors Mobile) that are provided as samples and references. They can be removed by uninstalling packages available in AEM. It is also a recommendation to Uninstall example content and users as part of the Adobe Experience Manager 5.6.1 Security Checklist specially in your Production environment.

The good part is that now we also have a  run mode option for installing or not installing the sample content while installing CQ from command line. These modes allow you to control the use of sample content. The sample content is defined before the quickstart is built and can include packages, configurations, etc:

Installation run modes are provided out-of-the-box:

  • author
  • publish


  • samplecontent
  • nosamplecontent


Environment in which I have successfully used it had:

  • Oracle Linux
  • java version “1.6.0_65”
  • 64 bit VM


These are two pairs of mutually exclusive run modes; for example, you can:

  • define either author or publish, not both at the same time
  • combine author with either samplecontent or nosamplecontent (but not both)


Command line installation:


  • You will need to configure your -XX:MaxPermSize and Xmx based on 32bit or 64bit VM and how much memory you can use.
  • I have renamed my CQ 561 jar to cq56-author-p4502.jar for author instance and cq56-publish-p4503.jar for publish instance.

Author instance installation command:

java -server -XX:MaxPermSize=256m -Xmx1024M -jar cq56-author-p4502.jar -r author, nosamplecontent

Publish instance installation command:

java -server -XX:MaxPermSize=256m -Xmx1024M -jar cq56-publish-p4503.jar -r publish, nosamplecontent

Once CQ gets installed you verify that none of the Geometrixx related content should have got installed.

5:21 PM Permalink

How to fix AEM-SiteCatalyst connection problem

Posted on Monday, November 25, 2013 By

Cloud Serivces in CQ 5.5 / AEM 5.6 allows easy integration with other Adobe Marketing Cloud products. These enablements usually involve inputting credentials for an account that has API access privilege. Adobe SiteCatalyst is among one of these Cloud Services.



Lately I’ve seen customers not able to enable the integration even they have ensured that they put in the right credentials. They got frustrated and had to open support tickets with Adobe to address the problem. It turns out that majority of these connection issues can be fixed if you understand which SiteCatalyst data center you should be using, and how to change the configuration from within CQ/AEM.

Here I will walk you through the steps one by one:

  1. See if you can connect to SiteCatalyst using your provided credential (with Web API Access):
  2. If you’re not able to log in, then try using the same credential to log into or
  3. Once you’re logged in, you should be landed on:
    • etc.
  4. See the pattern above? the subdomain (sc, sc2, sc3, sc4, www, www2, www3, www4, etc.) tells you exactly which Site Catalyst data center you’re connected to. You should use the same data center in CQ/AEM for the integration. However, CQ/AEM is defaulted to the San Jose data center (sc, or www) out of the box. If you’re using another data center, you need to configure CQ to point to the appropriate one.
  5. To do that, go to System Console in CQ/AEM at http://<domain>:<port>/system/console.
  6. Log in and go to the configuration page.
  7. And locate the Configuration “Day CQ Analytics SiteCatalyst HTTP Client”.
  8. The Data Center URLs is defaulted to Change it to the data center you should be connecting to. For example:
  9. Click Save.
  10. Now, go back to the Cloud Services Configuration and connect again with the same credential (CQ pointing to the correct SiteCatalyst data center now), you should be able to connect successfully.
4:41 PM Permalink

AEM HealthCheck exercise

Posted on Sunday, November 24, 2013 By

Recently I stepped into a few engagements to assess and evaluate how CQ/AEM was implemented for customers, be the implementation done by in-house developers, or via a solution partner. Since the “health check” area is a little vague, I want to use this post to list some of the exercises usually covered by such engagements. Note that some of the following might not necessarily be covered in all engagements, it varies depending based on customers needs and time given.

  • Study the solution via written documentation or direct interviews with customers and system integrators.
  • Review user interface, identify opportunities to optimize the performance for various experiences (web, mobile, kiosk, etc.)
  • Review CQ authoring process and work with customer to streamline and optimize the authoring experience.
  • Provide general performance optimization strategies including but not limited to: caching, use of CDNs, delivering the right fidelity assets at the right time, etc.
  • Provide general architectural guidance (Gap analysis between reference architecture and customer’s implementation) and environment audit.
  • Provide development and deployment best practices, including but not limited to:
    • Review templates and components for reusability.
    • Review information architecture.
    • Review OSGi configurations.
    • Review build and package management tools, source control being used, etc.
  • Code review and scoring using code analysis tools.
  • Validate the application of security checklist and go-live checklist.

At the end of the exercise, Adobe Consulting Services will compile and consolidate all the information collected, and will provide a document on all the findings from the engagement as well as suggestions and next steps.

Healthcheck is usually carried out onsite, and it typically lasts from a few days to a few weeks.

3:03 PM Permalink
  • Authors

  • Archives

  • Developer Resources