AEM is an enterprise level content management system. I might be stating the obvious here, but the keyword in my first sentence is enterprise. In any enterprise CMS, there are many moving pieces and technologies involved. At iCi, we’ve been developing with AEM since it was named CQ, and all of us are continually learning with each new project. I hope that the following list of tips and tricks will help you save time in your AEM journey.
1. View the logs in CRXDE. I must admit, I didn’t realize you could do this one until a couple of months ago. It’s especially handy when you don’t have access to the physical server. If you navigate to CRXDE, and in the area you normally view the properties of a node, you will see there is a “console” tab that you can click to open and view the logs.
2. Clear your JSP cache. I can’t tell you how many times I’ve fixed (or thought I fixed) an issue and couldn’t figure out why it wasn’t reflected when I pulled up the page. One of the first things I do now if I think a fix should work but it’s not being reflected on the page is clear my JSP cache. AEM has an easy way for you to do this via the OSGi console. Navigate to: http://localhost:4502/system/console/slingjsp and simply click the “recompile all jsps” button.
3. Quickly navigate to the various WCMModes. You can do this by simply adding a query string parameter of:
4. Can’t login to welcome screen. I originally thought I was one of the only ones that encountered this, but I’ve had a few colleagues run into this problem as well. The issue only appears to be in Chrome, but if you experience it just clear your browser cookies by going to:
Chrome Settings > More Tools > Clear Browsing Data > Ensure Cookies Checkbox is checked.
After you’ve followed these steps, login again and you’ll be good to go.
5. Debug ClientLibs. One extremely helpful trick when debugging a CSS or JS issue is ?debugClientLibs=true which you apply as a query string parameter to your URL. You will notice that it will return all of the individual files that the ClientLibs include. So essentially, the ClientLibs will be returned as multiple files instead of one file.
6. XPath Queries. One of the great features about AEM is the ability to easily query the JCR. You can do this by navigating to CRXDE, clicking on the Tools Tab > Query and entering your XPath Query. Say I want to find where all instances of a component are on a page. Just run the following XPath query:
You can do a variety of other things such as finding Pages that have a particular property, or pages built from a particular template just to name a few. There is also the option to run SQL and SQL2 queries to navigate the JCR as well.
7. Rebuild client libraries. Using the below query string parameter wipes away the ClientLibs and designs. Forcing it to rebuild itself. It’s very useful when dealing with caching issues.
8. AEM Viewer plugin. This last one is a Chrome plugin that is especially useful so I couldn’t leave it off the list. It has a variety of useful features such as a list of quick links, properties of the page, and even the ability to view the logs.
I’ve worked with AEM for years now, and these are just a few of the tips that I’ve figured out along the way. It’s fun for me to learn new, and hopefully easier and better ways of doing things; and then share them with the developer community. We regularly post about the ins and outs of systems and software, so be sure you come back to our blog to look for new information. And as always, feel free to contact us directly with questions or tricks that you have learned.