Pages

Tuesday, July 22, 2014

CQ5/AEM Gotchya - When trying to fake a post request, you get the following error in the logs:

The Problem

POST /my/post/url HTTP/1.1] org.apache.sling.security.impl.ReferrerFilter Rejected empty referrer header for POST request to /my/post/url

The Solution

The problem here is that you are not correctly spoofing the Referer address. To avoid this problem when testing, you can disable Referer filter checking by going to localhost:/4502/system/console/components, go to Apache Sling Referrer Filter, and check the "Allow Empty" checkbox.

This will disable the referrer security check in CQ5 for your developer instance.

NOTE: DO NOT DO THIS FOR PUBLICLY ACCESSIBLE CQ5/AEM INSTANCES AS IT POSES A SECURITY RISK

Wednesday, July 9, 2014

How to find the version number of CQ or AEM that you are running

Go to http://<author>:<port>/system/console/status-productinfo

And you can see the exact version and build number that has been installed.

Installed Products
  Adobe Experience Manager <versionNumber>

Tuesday, June 17, 2014

How to programatically design mode select a component to be included in the sidekick

The Problem

You want to have a component programatically available to authors without having to enter design mode and add a component for the template.

The Solution

Go to your relevant template's design mode. For this example, we will use the Geometrixx site, located at:

/etc/designs/geometrixx/jcr:content/contentpage/par

Then edit the components property to contain the path to your component, for example:
/apps/geometrixx/components/customcomponent

Save, and reload the editor, and you should have the component added to your list.


Friday, May 2, 2014

CQ5/AEM How do I detect from a SlingServlet whether it is running on the Master or Slave instance on an author cluster?

The Problem

You have a Sling Servlet performing a task on the author instance, and you are running as a cluster. The code is executing on both the master author and the slave author instance, when it should only be running on one.

How do you detect whether the instance is the master instance?

The Solution


@Reference
private SlingRepository repository;

public boolean isMasterRepository(){
    final String isMaster = repository.getDescriptor("crx.cluster.master");
    return StringUtils.isNotBlank(isMaster) && Boolean.parseBoolean(isMaster);
}

With this code, we can detect whether the current instance is running as the master.

In the execution function, the first conditional should be to detect whether it is running as the master instance or not, and if it is not, it should terminate the function call.

Thursday, May 1, 2014

CQ 5.6.1 How to find the current run mode on an instance

The Problem

You suspect your instance is not running in publish mode, or is missing a custom run mode on startup and need to find out easily what runmode the instance is running under.

The Solution

Go to:
http://localhost:4502/system/console/status-slingsettings

You will see the following line down the bottom:

Run Modes = [samplecontent, author, crx2, crx3mongo]


Thursday, December 19, 2013

CQ5/AEM How do I find out exactly which maven dependency I need?

The Problem

You are writing a customization in Java for CQ5/AEM, but the class you need is not currently included in the project, but it is available in CQ5.

You may know what dependency you need, but are unsure as to the version. What is the best way to find the right dependency to include in CQ5?

The Solution

Go to:
http://localhost:4502/system/console/depfinder



This is the package dependency lookup service. If you type in the package/class you need in the field, and click on Find, you will get the dependency you need to include.

Just copy and paste the dependency into your pom file.

Saturday, November 2, 2013

CQ5/AEM Dispatcher gotchya - dispatcher failed to map segment from shared object permission denied

The Problem

Although your dispatcher mod file is there, you can't seem to load the mod_dispatcher file.

The Solution

First, double check in your httpd.conf file that you are actually pointing to the right place. Remember that your ServerRoot is the prefix appended to the mod_dispatcher.so path file.

If the file is where you would expect it to be, check that the user you are running apache under has the rights to see the file.
ls -al
will show full permissions of the directory listing.
chown group:user will change the file ownership

chmod 755 will give read and execute rights to the owner, the group and everyone.

Finally, if you are running Red Hat Enterprise Linux (RHEL), it is possible you are running selinux, and don't even know it.

Have a look under /etc/sysconfig/selinux.

In the file, you may see selinux=enforcing.

If this is the case, then selinux probably doesn't like the dispatcher mod, and is blocking it. You can drop the permissions down to permissive or disable to remove it entirely, but check with your systems administrator, as this will have other effects on the system.